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
[alias] | |
sync = "!f(){ local branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\(.*\\)/\\1/\"`; git pull origin $branch && git push origin $branch; }; f" |
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
<? | |
class Lock { | |
const TIMEOUT = 20; | |
const SLEEP = 100000; | |
/** | |
* Stores the expire time of the currently held lock | |
* @var int |
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
<? | |
include_once 'iredis.php'; | |
class ActivityFeed { | |
private $redis; | |
public function __construct(){ | |
$this->redis = new iRedis(); |
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
scp redis-server-1:/var/lib/redis/appendonly.aof /var/lib/redis/appendonly.aof.1 | |
scp redis-server-2:/var/lib/redis/appendonly.aof /var/lib/redis/appendonly.aof.2 | |
cat /var/lib/redis/appendonly.aof.* > /var/lib/redis/appendonly.aof |
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
.counter { | |
display:block; | |
float:left; | |
font-size:2em; | |
line-height:1.2em; | |
-webkit-box-reflect: below -15px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(60%, transparent), to(rgba(255,255,255,0.3))); | |
} | |
.counter span.digit { | |
background:#161616; |
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
$(window).bind('facebook.liked', function(href, widget){ | |
// Do whatever stuff you need to here | |
}); |
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
<? | |
require 'Memcacheable.php'; | |
class Foo extends Memcacheable { | |
public function __construct(){ | |
$this->widget = "widget"; | |
} | |
public function bar($arg){ |
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
<? | |
include 'ActivityFeed.php'; | |
$feed = new ActivityFeed(); | |
$feed->add(123, 'Nicky followed Kelly', time() + 5); | |
$feed->add(123, 'Nicky followed Josh', time() + 10); | |
$feed->add(123, 'Nicky earned 1200 points for being awesome!', time() + 30); |
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
cat /dev/null | tee *.log |
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
<? | |
function find_category($id, $categories){ | |
if(!count($categories)) return false; | |
foreach($categories as $set){ | |
if($set['id'] == $id) return $set['t']; | |
$category = find_category($id, $set['c']); | |
if($category) break; | |
} | |
NewerOlder