This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$parts = secondsToDuration(61); | |
assert($parts['hours'] === 0); | |
assert($parts['minutes'] === 1); | |
assert($parts['seconds'] === 1); | |
assert('PT0H1M1S' === formatDuration($parts)); | |
$parts = secondsToDuration(7202); | |
assert($parts['hours'] === 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For apache virtualhost you just need something simple like this: | |
<VirtualHost *:80> | |
ServerName heroized | |
DocumentRoot /vagrant/heroized | |
<Directory /vagrant/heroized> | |
Options Indexes FollowSymLinks | |
AllowOverride all | |
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generic behaviour for an object which can observe objects | |
* @param {array | object} items | |
*/ | |
Xteam.Observer = function(items) { | |
items = items || []; | |
// wrap items in an array | |
if (typeof items.length == "undefined") { | |
items = [items]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PWD=`dirname $0` | |
cd $PWD | |
## memcached | |
~/src/term.sh -t memcached | |
## couchdb | |
~/src/term.sh -t sudo -i -u couchdb couchdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#content { | |
background: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
chdir(dirname(__FILE__)); | |
require_once '../app/setup.php'; | |
$username = $argv[1]; | |
if (!$username) { | |
echo "usage {$argv[0]} {username} {new_email}\n"; | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TextOverflow = { | |
crop: function(elm) { | |
var w = elm.width(), | |
t = elm.text(), | |
child; | |
elm.html('<span style="overflow: hidden; white-space: nowrap">'+t+'</span>'); | |
child = elm.children(":first-child"); | |
while (t.length > 0 && child.width() > w) { | |
t = t.substr(0, t.length - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hijack a function with custom behaviour | |
* @param {object} Context object | |
* @param {string} Name of the context object's function | |
* @param {function} Override function | |
* @return {function} Original function | |
*/ | |
function hijack(object, funcName, override) { | |
var original = object[funcName]; | |
object[funcName] = override(original); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Instead of adding each js file one by one to a page, | |
* we define a chain of dependencies and then just include the top-level components. | |
* | |
* This makes it easier to see what components are being used on a page, | |
* and easier to add/remove/replace components. | |
*/ |