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
| // Sample custom iterator. | |
| // By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558) | |
| // From: http://www.dreamincode.net/forums/index.php?showtopic=58468 | |
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <iterator> | |
| #include <cassert> |
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
| # Config for Nginx to act as a front-end for Riak | |
| # The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc) | |
| # Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_) | |
| # Config is in /etc/nginx/sites-available/default or somewhere like that | |
| # Set up load-balancing to send requests to all nodes in the Riak cluster | |
| # Replace these IPs/ports with the locations of your Riak nodes | |
| upstream riak_hosts { | |
| server 127.0.0.1:8098; |
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
| # 30 minutes Lisp in Ruby | |
| # Hong Minhee <http://dahlia.kr/> | |
| # | |
| # This Lisp implementation does not provide a s-expression reader. | |
| # Instead, it uses Ruby syntax like following code: | |
| # | |
| # [:def, :factorial, | |
| # [:lambda, [:n], | |
| # [:if, [:"=", :n, 1], | |
| # 1, |
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
| BEGIN { | |
| require 'net/http' | |
| Net::HTTP.module_eval do | |
| alias_method '__initialize__', 'initialize' | |
| def initialize(*args,&block) | |
| __initialize__(*args, &block) |
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
| Emacs Rails | |
| C-c n Goto Mailer | |
| C-c z '' RSpec Fixture | |
| C-c x '' Fixture | |
| C-c c '' Controller | |
| C-c g '' Migration | |
| C-c r '' RSpec | |
| C-c u '' Unit Test | |
| C-c m '' Model |
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
| Gems: | |
| gem 'cucumber' | |
| gem 'cucumber-rails' | |
| gem 'rspec' | |
| gem 'rspec-rails' | |
| gem 'capybara' | |
| gem 'database_cleaner' | |
| gem 'spork' | |
| gem 'watchr' |
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
| # config/initializers/notifications.rb | |
| # created by @JEG2 | |
| if Rails.env == "development" | |
| ActiveSupport::Notifications.subscribe( | |
| "sql.active_record" | |
| ) do |_, start, finish, _, details| | |
| time = finish - start | |
| if time >= 0.5 | |
| raise "Slow query (#{time}s): #{details[:sql]}" |
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 | |
| class MRISC | |
| def run(code) | |
| tokens = code.gsub(/(\*.*?\*)|[^a-z0-9,-;@\._]/,'').split(';') | |
| @vars,stack,i = {:_pc=>-1,:_oc=>0},[],0 | |
| tokens.map!{|t| t.chars.first=='@' ? (@vars[t.to_sym]=i-1;nil) : (i+=1;t.split(',').map{|e|numeric?(e) ? e.to_i : e.to_sym})}.compact! | |
| while @vars[:_pc] < tokens.size-1 | |
| @vars[:_pc] += 1 | |
| @vars[:_oc] += 1 |
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
| # Usage: new-github topfunky tidy_table | |
| function new-github() { | |
| git remote add origin [email protected]:$1/$2.git | |
| git push origin master | |
| git config branch.master.remote origin | |
| git config branch.master.merge refs/heads/master | |
| git config push.default current | |
| } |
OlderNewer