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
#!/usr/bin/env ruby | |
['rubygems', 'eventmachine'].map{|x| require x} | |
module SelfServer; def receive_data(data); send_data(IO.readlines __FILE__); end; end; | |
EventMachine::run do | |
host = ARGV[1] || '0.0.0.0' | |
port = ARGV[2] || 8080 | |
EventMachine::start_server host, port, SelfServer | |
puts "If you don't like defaults try chaging host or port" | |
puts "Open 2 terminal and try telnet #{host} #{port} and press enter" | |
end |
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 | |
### BEGIN INIT INFO | |
# Provides: god | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: God | |
### END INIT INFO |
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
module PoorManHook | |
module ClassMethods | |
private | |
def after(*syms, &block) | |
syms.each do |sym| # For each symbol | |
str_id = "__#{sym}__after__" | |
unless private_instance_methods.include?(str_id) |
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
before_filter :log_ram # or use after_filter | |
def log_ram | |
logger.warn 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip | |
end |
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 $j = jQuery.noConflict(); | |
// Use jQuery via $j(...) | |
$j(document).ready(function(){ | |
$j("div").hide(); | |
}); | |
// Use Prototype with $(...), etc. | |
$('someid').hide(); |
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
Printf.printf "Hello out there\n%!";; | |
let rec fibonacci n = if n < 3 then 1 else fibonacci (n-1) + fibonacci (n-2);; | |
Printf.printf "Please enter an integer number: %!";; | |
let n = read_int () | |
in Printf.printf "The %d'th Fibonacci number is %d\n%!" n (fibonacci n);; | |
(* run it by "ocaml fib.ml" or compile "ocamlopt -o fib fib.ml"*) |
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 | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 url output-pdf-file" | |
exit 1 | |
fi | |
set -e | |
documenturl="$(echo -n "$1" | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g')" | |
viewerurl="http://docs.google.com/viewer?url=$documenturl" |
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
return{ | |
ok: false | |
}; | |
return | |
{ | |
ok: 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
gem 'devise', '1.5.0' | |
gem 'omniauth-facebook', :git => "git://github.com/mkdynamic/omniauth-facebook.git" | |
gem 'rspec-rails', :group => [:development, :test] | |
group :test do | |
# Pretty printed test output | |
gem 'turn', '< 0.8.3', :require => false | |
gem 'cucumber-rails' | |
gem 'capybara' |