This file contains hidden or 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 | |
$filename = $_SERVER['REQUEST_URI']; | |
if ($i = strpos($filename, '?')) { | |
$filename = substr($filename, 0, $i); | |
} | |
if (file_exists(__DIR__ . $filename)) { | |
return false; | |
} |
This file contains hidden or 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 | |
include 'pheanstalk/pheanstalk_init.php'; | |
$ph = new Pheanstalk_Pheanstalk('127.0.0.1'); | |
$ph->ignore('default')->watch($tube); | |
while ($job = $ph->reserve(0)) { | |
$ph->delete($job); | |
fwrite(STDOUT, $job->getId() . "\r"); |
This file contains hidden or 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 cluster = require('cluster'), | |
numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
while (numCPUs-- > 0) cluster.fork(); | |
cluster.on('exit', function(worker, code, signal) { | |
console.log('worker ' + worker.process.pid + ' died'); | |
cluster.fork(); | |
}); |
This file contains hidden or 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/bash | |
#.git/hooks/pre-commit | |
EXEC=`php -r "echo 'php ', implode(DIRECTORY_SEPARATOR, [__DIR__, 'vendor', 'bin', 'phpcs']);"` | |
FILES=`git diff --cached --name-only | grep -i php$ | grep ^app` | |
ARGS='--standard=psr2 --encoding=utf8 -p' | |
for fn in $FILES; do | |
if [ ! -f $fn ]; then | |
DELETE=($fn) |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"time" | |
"sync/atomic" | |
) | |
const ( | |
ITEM_DATA_SIZE = 4096 |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"regexp" | |
"strings" | |
) |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"strings" | |
"database/sql" | |
) | |
const ( | |
SQL_INSERT = "INSERT INTO %s (%s) VALUES (%s)" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"io" | |
"bufio" | |
"runtime" | |
"path/filepath" |
This file contains hidden or 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
package main | |
import ( | |
"net" | |
"io" | |
"log" | |
) | |
func main() { | |
l, err := net.Listen("tcp", "127.0.0.1:9999") |
This file contains hidden or 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/bash | |
while [ ! -d .hg ]; do | |
cd .. | |
[ -f proc/cpuinfo ] && break | |
done | |
[ ! -d .hg ] && echo 'Oops! No hg repository found.' && exit | |
for f in `hg st | awk '{print $2}'`; do |