I hereby claim:
- I am davidreuss on github.
- I am davidreuss (https://keybase.io/davidreuss) on keybase.
- I have a public key whose fingerprint is 66A8 9B03 C960 334E 6670 1232 B26C A5EE 635A 8528
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
<?php | |
class NamedArguments { | |
static function init($args) { | |
$assoc = reset($args); | |
if (is_array($assoc)) { | |
$diff = array_diff(array_keys($assoc), array_keys($args)); | |
if (empty($diff)) return $assoc; | |
trigger_error('Bad parameters: '.join(',',$diff), E_USER_ERROR); | |
} |
<?php | |
class MyController extends Zend_Controller_Action { | |
public $contexts = array( | |
'request' => array('json', 'html') | |
); | |
public function requestAction() { | |
$this->view->fields = Foo::getFields(); | |
// Here i want to build the form - but ONLY if context is 'html' |
wget -m -k -K -E <URL> # archive entire site |
#!/bin/sh | |
if [ $# -eq 2 ]; then | |
email="$1" | |
password="$2" | |
curl -L -d "email=$email&password=$password" -c ontv.cookie 'http://ontv.dk/scripts/users.php?action=login' | |
xmltvurl=$(curl -b ontv.cookie 'http://ontv.dk/xmltv' | perl -ne '/(http:\/\/ontv.dk\/xmltv\/\w+)/ and print $1') | |
curl -o xmltv.xml "$xmltvurl" | |
rm ontv.cookie | |
exit 0 |
// Thanks: http://snook.ca/archives/php/url-shortener | |
$codeset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
$base = strlen($codeset); | |
$n = 300; | |
$converted = ""; | |
while ($n > 0) { | |
$converted = substr($codeset, ($n % $base), 1) . $converted; | |
$n = floor($n/$base); |
<?php | |
$connection = new PDO($dsn); | |
// 1. | |
$persons = new Table($connection, 'persons'); | |
$joe = $table->createRow(array('name' => 'Joe')); | |
$persons->save($joe); | |
// 2. | |
$person = array( |
git config gitex.exportbranch PHP5 |
<?php | |
class Helper_ActionCache extends Zend_Controller_Action_Helper_Abstract { | |
public function preDispatch() { | |
$this->fire('pre'); | |
} | |
public function postDispatch() { | |
$this->fire('post'); | |
} |