An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
# A list of possible usernames to reserve to avoid | |
# vanity URL collision with resource paths | |
# It is a merged list of the recommendations from this Quora discussion: | |
# http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features | |
# Country TLDs found here: | |
# http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains | |
# Languages found here: |
namespace :deploy do | |
namespace :assets do | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
from = source.next_revision(current_revision) | |
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0 | |
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} | |
else | |
logger.info "Skipping asset pre-compilation because there were no asset changes" | |
end | |
end |
/* | |
$ gcc -std=c99 a.c | |
$ ./a.out 10000000 | |
10000000 bits... | |
precmp8: 11ms (1250001) | |
POPCNT: 6ms (1250001) | |
$ ./a.out 100000000 | |
100000000 bits... | |
precmp8: 111ms (12500001) | |
POPCNT: 62ms (12500001) |
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
#!/bin/sh | |
usage() | |
{ | |
echo "usage: ${0} {start|stop|graceful_stop|stop_child|restart} <any_process_keyword>" | |
exit 1 | |
} | |
start_app() { | |
${app_cmd} 2>&1 | logger -t resque_worker & | |
} |
> perl -E 'say "生" & "死"' | |
愛 | |
生 Life U+751F \xe7\x94\x9f 11100111 10010100 10011111 | |
死 Death U+6B7B \xe6\xad\xbb 11100110 10101101 10111011 | |
愛 Love u+611B \xe6\x84\x9b 11100110 10000100 10011011 |
require 'rubygems' | |
require 'redis' | |
require 'redis/distributed' | |
r = Redis::Distributed.new %w[redis://host1:6379 redis://host2:6379] | |
# show node for key "foo" | |
p r.node_for("foo") | |
# set the value of "foo" |
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
# | |
# Usage: | |
# class ApplicationController < ActionController::Base | |
# include ErrorPages | |
# end | |
# | |
module ErrorPages | |
extend ActiveSupport::Concern | |