Graph with author and commit hash:
git config --global alias.plog 'log --graph --pretty=format:\"%C(yellow)%h%x20%C(green)%an%x20%Creset%s\"'
// Allows specifying default variables in LESS | |
// Some really sneaky shit that will shoot me in the foot if | |
// LESS changes too much... | |
@--lol: ~`"" + ( root._less = root._less || this )`; | |
@--lol: ~`"" + ( root.getLessVar = function (name) { return root._less[name] ? root._less[name].toJS() : '' } )`; | |
@--lol: ~`"" + ( root.getLessVarDefault = function (name, def) { return root.getLessVar(name) !== '' ? root.getLessVar(name) : root.getLessVar(def) } )`; | |
// Example: |
tmp_prefix="/usr/local/bin/" | |
echo "git pull;" > $tmp_prefix-; | |
echo "git push;" > $tmp_prefix=; | |
echo "git pull && git push;" > $tmp_prefix-=; | |
chmod 755 $tmp_prefix- $tmp_prefix= $tmp_prefix-=; |
{ | |
//----------------------------------------------------------- | |
// Important information | |
// Name and version are required and together are treated as | |
// a unique identifier for a particular build. Name | |
// [http://npmjs.org/doc/json.html#name] and version | |
// [http://npmjs.org/doc/json.html#version] are strings. | |
"name": "mypackage", | |
"version": "0.1", |
# represents a person | |
class Person | |
# properties | |
name: null | |
alive: true | |
stomach: 0 | |
bladder: 0 | |
<?php | |
// looking for the spoiler image mentioned in https://twitter.com/notch/status/84361767962161152 | |
$letters = array_merge(range('a', 'z'), range('A', 'Z')); | |
foreach ($letters as $letter) { | |
$image = 'http://i.imgur.com/IKc7' . $letter . '.png'; | |
print '<img src="' . $image . '" alt="Is is this one?" style="display: block; margin: 0 0 20px 0"/>'; | |
} |
<?php | |
function hello($arg = 'World') { | |
// sanitize arguments | |
$arg = $arg ?: 'World'; | |
// return message | |
return "Hello {$arg}!"; | |
<?php | |
//============================================================ | |
// CONSTANTS | |
// direction (for strpos etc) | |
String::FORWARD; | |
String::REVERSE; | |
// case | |
String::CASE_LOWER; |
<?php | |
// I've been doing this | |
foreach ($array as $key => $value) { | |
$array[$key] = $modified_value; | |
} | |
// rather than this | |
foreach ($array as &$value) { | |
$value = $modified_value; |
<?php | |
/** | |
* Get the relative time between two timestamps. | |
* | |
* @access public | |
* @param integer|string $time The date or timestamp that represents the time we're comparing to. | |
* @param integer|string $comparison_time [optional] The date or timestamp we want comparisons to be relative to. Defaults to the current timestamp. | |
* @param boolean $return_array [optional] Whether to return the relative time as an array of components rather than a string. Default value is FALSE. | |
* @return string Returns the amount of time between the two timestamps as a string or an array if $return_array is TRUE. |