Skip to content

Instantly share code, notes, and snippets.

@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@funny-falcon
funny-falcon / changes.md
Last active August 15, 2024 15:13
Performace patch for ruby-1.9.3-p327

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@aminin
aminin / example.rb
Created July 25, 2013 13:02
Multithread amazon s3 bucket copier + EventMachine patch for Fog::Connection
require './s3-bucket-copier'
credentials = {
:provider => "AWS",
:region => "eu-west-1",
:aws_access_key_id => "<KeyId>",
:aws_secret_access_key => "<KeySecret>"
}
connection = ::Fog::Storage.new(credentials)
require 'benchmark'
begin
require 'active_support/values/time_zone'
rescue LoadError
puts 'Please do `gem install active_support`'
exit(1)
end
def benchmark_hash(hash, key, inverted_hash)
Benchmark.bmbm do |x|