Skip to content

Instantly share code, notes, and snippets.

This is a proof-of-concept of a couple of concurrent data structures written in Ruby.

The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

@jimweirich
jimweirich / output
Created December 27, 2012 14:55
Experimental version of RSpec/Given that handles should-less assertions (i.e. plain Ruby conditions).
1) Natural Assertions
Failure/Error: Then { foo + bar == 2 }
Then expression failed at /Users/jim/working/git/rspec-given/examples/failing/sample_spec.rb:6
expected: 3
to equal: 2
false <- foo + bar == 2
3 <- foo + bar
1 <- foo
2 <- bar
# ./lib/rspec/given/extensions.rb:64:in `_rg_evaluate'
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
@chendo
chendo / 0-readme.md
Created November 13, 2012 03:33
Fast require patch for 1.9.3-p327

A daily glance at what's happening in a high velocity codebase, thanks to @defunkt:

https://github.com/your/repo/compare/master@{yesterday}...master

Bookmark, share, and enjoy.

@garybernhardt
garybernhardt / gist:3180009
Created July 26, 2012 03:05
An excerpt from GCC's reload.c
static int
find_reusable_reload (rtx *p_in, rtx out, enum reg_class rclass,
enum reload_type type, int opnum, int dont_share)
{
rtx in = *p_in;
int i;
/* We can't merge two reloads if the output of either one is
earlyclobbered. */
if (earlyclobber_operand_p (out))
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tomykaira
tomykaira / rack.md
Created May 19, 2012 17:17
Brief Introduction to Rack -- from codereading activity

Brief Introduction to Rack

@tomy_kaira

Rack

Specification

for communication between Server and Ruby WAF

@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
@steveclarke
steveclarke / capybara.md
Created April 10, 2012 17:32
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)