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
# config/initializers/oedipus.rb | |
require "oedipus" | |
# Monkey patch in oedipus instrumentation | |
module Oedipus | |
class LogSubscriber < ActiveSupport::LogSubscriber | |
def search(event) | |
output = "%s (%.2fms)" % ['Sphinx', event.duration] | |
debug " #{color(output, RED, true)}" |
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
build tools { | |
build-essential { | |
apt { | |
package manager { | |
'apt-get' runs from /usr/bin. | |
} ✓ package manager | |
apt source { | |
} ✓ apt source | |
apt source { | |
} ✓ apt source |
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
dep "sphinx.src" do | |
source "http://sphinxsearch.com/files/sphinx-2.0.4-release.tar.gz" | |
define_var :base_dir, :default => Pathname.new(File.dirname(__FILE__) + "/../lib/sphinx2").cleanpath | |
provides var(:base_dir) + "/bin/searchd" | |
prefix var(:base_dir) | |
install { shell "make install" } | |
meet do | |
shell "mkdir -p #{var(:base_dir) / 'binlog'}" |
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
# See: https://github.com/beoran/chipmunk/tree/master/spec | |
# + http://chipmunk-physics.net/release/ChipmunkLatest-Docs/ | |
require 'chipmunk' # gem install chipmunk | |
s = CP::Space.new | |
s.gravity = vec2(0,0) | |
b1 = CP::Body.new(5, 7) | |
b1.pos = vec2(400,600) | |
b1.v = vec2(30,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
# screen had it right, C-B is too hard to reach. | |
unbind C-b | |
set -g prefix ` | |
# set -g prefix ` | |
# http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/ | |
unbind % | |
bind | split-window -h | |
bind - split-window -v |
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
def fib | |
f0, f1 = 0, 1 | |
loop do | |
f0, f1 = f1, (f0 + f1) | |
r = yield f1 | |
return if !r | |
end | |
end | |
fib do |n| |
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 | |
function ($) { | |
echo "Hello $!\n"; | |
} | |
("world"); | |
function test($̀a) { echo $̀a; } | |
test("zomg!\n"); |
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 | |
function ($hello, $hello, $̀) { | |
echo "$hello$hello$̀\n"; | |
} | |
("lolol", "trolo", "!"); |
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 | |
require_once __DIR__.'/../vendor/autoload.php'; | |
require_once __DIR__.'/../lib/kelpie/lib/kelpie.php'; | |
require_once 'KelpieSymfonyAdaptor.php'; | |
$app = new Silex\Application(); | |
$app->get('/hello/{name}', function ($name) use ($app) { | |
return 'Hello '.$app->escape($name); | |
}); |
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 | |
use Symfony\Component\HttpFoundation\Request; | |
class KelpieSymfonyAdaptor | |
{ | |
public function __construct($app) | |
{ | |
$this->_app = $app; | |
} |