Minimalistic git commands
Lists all the modified files only. The number of lines of the output determines the number of files/folders modified.
git status --short --untracked-files=no
/** | |
* This is how you intval in PostgreSQL | |
**/ | |
SELECT cast( coalesce( nullif( column_name_here, 0 ), '0') as integer ) AS column_name_alias_here FROM table_name_here |
CREATE FUNCTION function_name_here(character varying) RETURNS text AS $$ | |
SELECT column_name FROM "TABLE_NAME" GROUP BY "_ORDINAL_NUMBER" ORDER BY "_ORDINAL_NUMBER"; $$ | |
LANGUAGE SQL | |
IMMUTABLE | |
RETURNS NULL ON NULL INPUT; |
<?php | |
$date = new DateTime('2000-01-01'); | |
echo $date->format('Y-m-d H:i:s'); | |
?> |
/** Minimal example **/ | |
SELECT | |
CASE | |
WHEN 1 > 0 THEN 'one is greater than zero' | |
ELSE 'something else' | |
END AS "ALIASED_FIELD_NAME_HERE" | |
/** In table example **/ | |
SELECT | |
CASE |
CREATE FUNCTION safe_divide(numeric, numeric) RETURNS numeric AS $$ | |
SELECT | |
CASE | |
WHEN $2 = 0 THEN 0 | |
ELSE $1/$2 | |
END AS quotient; $$ | |
LANGUAGE SQL | |
IMMUTABLE | |
RETURNS NULL ON NULL INPUT; |
Google Image Charts API is dead! This is a great alternative on building web services that display chart/graph images rendered in PNG.
import sys | |
print(sys.argv[0]) # CommandLineArguments.py | |
print(sys.argv[1]) # hello | |
print(sys.argv[2]) # world | |
#python CommandLineArguments.py hello world |
#!/bin/bash | |
while read oldrev newrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [ "master" == "$branch" ]; then | |
WORKTREE=/var/www/html/app/ | |
git --work-tree=$WORKTREE checkout -f $branch | |
echo "Changes were successfully pushed to staging server at location $WORKTREE" | |
find $WORKTREE -iname "*.php" | xargs chmod 665 | |
find $WORKTREE* -type d | xargs chmod 775 |