Apply changes from one local branch to another

$ git log 
$ git checkout <branch-to-apply-changes>
$ git cherry-pick <sha1-of-the-commit>


Required Labels

Easiest way to add an * to required field labels

/* By default, required field labels are 
   rendered with the "required" class */

.required:after {
    content: "*";

Tweeting from shell

$ curl -u user:pass -d status='Hello from shell'

Returns a single value


$q = Doctrine_Query::create()
  ->select('a.title as title')
  ->from('Article a')
  ->where(' = ?', $this->getId());

Avoid circular references

Avoiding circular references using the free() function

$qs = Doctrine_Query::create()
    ->from('MyTable1 m')
    ->leftJoin('m.MyTable2 p');

$res = $qs->execute();

Search for Column

Show all tables that have a specific column name


Env Vars Oracle

Environment variables that must be set on Windows to connect to a remote Oracle DB(client)

NLS_LANG  <lang> - character set,  
                         language and territory
TNS_ADMIN <path> - path to tnsnames.ora file
PATH      <path> - add location of the 
                         Oracle client

Zebra Tables

Zebra tables with structural pseudo-classes

tr:nth-child(2n+1){ background: ‪#fff‬ } 
tr:nth-child(2n+0){ background: ‪#ffffec‬ }

Only digits

$str = '13++56-461.79/27--14-abc';

$filter              = filter_var($str,FILTER_SANITIZE_NUMBER_INT);
$onlyDigitsFilterVar = str_replace(array('+', '-'), '', $filter);

$onlyDigitsRegexp1   = preg_replace('/[^\d]/', '', $str);
$onlyDigitsRegexp2   = preg_replace('/[^[:digit:]]/', '', $str); 

var_dump($filter);              // string(19) "13++56-4617927--14-"
var_dump($onlyDigitsFilterVar); // string(13) "1356461792714"
var_dump($onlyDigitsRegexp1);   // string(13) "1356461792714"
var_dump($onlyDigitsRegexp2);   // string(13) "1356461792714"


Using YQL to find WOEID

SELECT  woeid 
FROM    geo.places 
WHERE   text="brasília, df, brazil"

Empty / NULL

decode(trim(col),NULL,NULL,col) is NULL


-- Do not use null to represent a value of zero, because they are
--        not equivalent.

-- Note: Oracle Database currently treats a character value with 
--       a length of zero as null. 
-- However, this may not continue to be true in future releases, 
--       and Oracle recommends that 
-- you do not treat empty strings the same as nulls.