Skip to content

Instantly share code, notes, and snippets.

View jllodra's full-sized avatar
💭
Busy making customers happy

Josep Llodrà jllodra

💭
Busy making customers happy
View GitHub Profile
@jllodra
jllodra / app.css
Last active August 29, 2015 14:19 — forked from rdtsc/app.css
body {
font-family: sans-serif;
}
section {
margin-bottom: 40px;
}
h1 {
font-size: 20px;
#!/bin/sh
#
# /etc/init.d/tomcat -- startup script for the Tomcat 7 servlet engine
#
# Modified init-Script from Ubuntu Tomcat init-script
#
# 2010 - Sebastian Mogilowski - http://www.mogilowski.net/2010/12/11/install-tomcat-7-on-debian-lenny-with-virtual-hosts-and-apache2-integration/
# 2012 - Collin Peters - Added debug option
#
### BEGIN INIT INFO
@jllodra
jllodra / db_to_csv_function.sql
Created November 19, 2013 13:17
PostgreSQL: create one .csv per db table
DO LANGUAGE plpgsql $$
declare
tables RECORD;
statement TEXT;
path TEXT := '/home/user/destination_dir';
begin
FOR tables IN
SELECT (table_schema || '.' || table_name) AS schema_table
FROM information_schema.tables t INNER JOIN information_schema.schemata s
ON s.schema_name = t.table_schema
@jllodra
jllodra / date_ranges.js
Last active May 30, 2018 13:52
Calculate start/end dates for common ranges in Javascript.
// Calculate and set ranges: today, yesterday, this week, past week, this month, past month, this year
switch(newValue) {
case 'today':
initial_date.setValue(new Date());
end_date.setValue(new Date());
break;
case 'yesterday':
var d = new Date();
d.setDate(d.getDate() - 1);
initial_date.setValue(d);
@jllodra
jllodra / fail-login-redirect.php
Created November 12, 2012 19:44
Wordpress "custom redirect when login fails" plug-in
<?php
/*/
Plugin Name: Fail login redirect
Plugin URI: http://herotyc.untergrund.net
Description: Redirect to custom page when login fails
Version: 1.0
Author: Josep Llodra
Author URI: http://herotyc.untergrund.net
/*/
@jllodra
jllodra / color-bash.sh
Created October 10, 2012 07:30
Bash color codes (this script is not mine)
#!/bin/bash
# prints a color table of 8bg * 8fg * 2 states (regular/bold)
echo
echo Table for 16-color terminal escape sequences.
echo Replace ESC with \\033 in bash.
echo
echo "Background | Foreground colors"
echo "---------------------------------------------------------------------"
for((bg=40;bg<=47;bg++)); do
@jllodra
jllodra / .vimrc
Created September 10, 2012 21:07
.vimrc (my settings in Lion, Vim 7.3)
syntax on
set encoding=utf-8
set noautoindent
set ch=2
set cinoptions=(0
set nocompatible
set noerrorbells
set esckeys
set laststatus=2
set expandtab
@jllodra
jllodra / .bash_profile
Last active October 10, 2015 12:58
.bash_profile (based on ideas and code from here and there)
# Colours
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red - Bold
bldgrn='\[\e[1;32m\]' # Green - Bold