Cherry-pick
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'
https://twitter.com/statuses/update.xml
Returns a single value
<?php
$q = Doctrine_Query::create()
->select('a.title as title')
->from('Article a')
->where('a.id = ?', $this->getId());
->fetchOne()->title;
Avoid circular references
Avoiding circular references using the free() function
<?php
$qs = Doctrine_Query::create()
->from('MyTable1 m')
->leftJoin('m.MyTable2 p');
$res = $qs->execute();
$qs->free();
Search for Column
Show all tables that have a specific column name
SELECT TABLE_NAME FROM USER_TAB_COLUMNS
WHERE COLUMN_NAME = 'ID'
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
<?php
$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);
// http://www.php.net/manual/en/regexp.reference.character-classes.php
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"
Find WOEID
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
-- https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements005.htm
-- 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.