Skip to content

Instantly share code, notes, and snippets.

andhapp /
Created Nov 17, 2015 — forked from flarik/
Pow's .porwrc config file for use with RVM's config files .rvmrc or .ruby-version (+ optional .ruby-gemset)
if [ -f "${rvm_path}/scripts/rvm" ]; then
source "${rvm_path}/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
elif [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
andhapp / nginx.conf
Created Oct 17, 2015 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View gist:0d8d3ee93fd79aefcfd8

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at:

2. Install the Command Line Tools (CLT)

View MySingleton.js
var instance = null;
function MySingleton(){
if(instance !== null){
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()");
View standalone.rb
#!/usr/bin/env ruby
puts "Run this in another terminal:"
puts ""
puts " sudo ./ #{$$}"
puts ""
puts "... wait for the 'Ready!' message, switch back here and press enter to start."
View lib-rails_compatible_simple_delegator.rb
# See:
# *
# *!topic/rubyonrails-core/PjGUK72BmFA
# *
require "delegate"
class RailsCompatibleSimpleDelegator < SimpleDelegator
def self.const_missing(name)
if ::Object.const_defined?(name)

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.

View tracepoint.rb
class Foo
def; end
def foo; end
tp ="call") do |trace|
p [trace.defined_class, trace.method_id, trace.event, trace.lineno]
View development.txt
disable 1
enable 1
require 1983
load_dependency 485
[] 18
hash 15
initialize 6
View proxy.rb
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
# Copyright (C) 2009 Torsten Becker <>
require 'socket'
require 'uri'