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 | |
defined('STDERR') OR define('STDERR', fopen('php://stderr', 'w')); | |
logger::implement('write', function ($type, $message) { | |
$remote = server('REMOTE_ADDR'); | |
$message = preg_replace('/[\r\n]+\s*/', ' ', $message); | |
fputs(STDERR, "$remote [$type] $message\n"); | |
}); |
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
mkdir -p /app | |
# Prepare the filesystem | |
mkdir -p /tmp/build | |
cd /tmp/build | |
# Compiling Apache | |
curl http://www.us.apache.org/dist/httpd/httpd-2.2.24.tar.gz | tar xzf - |
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
cd /tmp | |
curl http://pecl.php.net/get/mongo/1.2.11 | tar xzf - | |
cd mongo-1.2.11 | |
/app/php/bin/phpize | |
./configure --with-php-config=/app/php/bin/php-config | |
make && make install | |
cd .. |
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 | |
$url = urlencode('http://wordpress.org'); | |
$width = 200; | |
$request = "http://s.wordpress.com/mshots/v1/$url?w=$width"; | |
echo "Link: $request"; |
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
hub(){ | |
REPO="$(git remote -v | grep fetch | sed 's/origin//' | tr ':' '/' | sed 's/.*git@/http:\/\//' | sed 's/.git *([a-z]*)//')" | |
if [ "$(whereis xdg-open)" ] ; then | |
cmd="xdg-open" | |
else | |
cmd="open" | |
fi | |
$cmd "$REPO" | |
} |
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 | |
# through DSN | |
$db = connect(...); | |
$tbl = 'my_table'; | |
$col = 'my_column'; | |
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 | |
function region($from) | |
{ | |
static $url = 'http://www.geoiptool.com/?IP=%s'; | |
$html = file_get_contents(sprintf($url, $from)); | |
$html = strip_tags($html, '<a><span>'); |
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/sh | |
OPTIONS='-avlzC --progress --exclude-from exclude.txt --stats' | |
TRANSPORT='ssh -p 22' | |
CONNECTION='[email protected]' | |
REMOTE_PATH='/var/www' | |
eval "rsync $OPTIONS -e '$TRANSPORT' . $CONNECTION:$REMOTE_PATH" |
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
// font-face mixin | |
.font(@path, @family, @weight: normal, @style: normal) { | |
@eot: asset-path("@{path}.eot"); | |
@woff: asset-path("@{path}.woff"); | |
@ttf: asset-path("@{path}.ttf"); | |
@svg: asset-path("@{path}.svg"); | |
@font-face { | |
src: url('@{eot}'); | |
src: local("☺"), |
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
(function($, undefined) { | |
$ujs = { | |
token: $('meta[name=csrf-token]').attr('content'), | |
fire: function(obj, name, data) { | |
var evt = $.Event(name); | |
obj.trigger(evt, data); | |
return evt.result !== false; |