Skip to content

Instantly share code, notes, and snippets.

@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@jswanner
jswanner / after_use_192-patched.sh
Created August 2, 2011 17:46
How to patch ruby for GC tuning and faster requiring
case "$rvm_ruby_string" in
*ruby-1.9.2*-patched)
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
export RUBY_FREE_MIN=$RUBY_HEAP_FREE_MIN
;;
*)
@jswanner
jswanner / Gemfile.diff
Created October 7, 2011 19:23
Differences between Rails 3.1.0.rc4 & Rails 3.1.1 generated apps
diff -U 0 -r rails-3.1.0.rc4/Gemfile rails-3.1.1/Gemfile
--- rails-3.1.0.rc4/Gemfile 2011-10-07 12:02:26.000000000 -0400
+++ rails-3.1.1/Gemfile 2011-10-07 12:59:13.000000000 -0400
@@ -3 +3 @@
-gem 'rails', '3.1.0.rc4'
+gem 'rails', '3.1.1'
@@ -10,4 +10,8 @@
-# Asset template engines
-gem 'sass-rails', "~> 3.1.0.rc"
-gem 'coffee-script'
@thermistor
thermistor / assets.rake
Created October 20, 2011 13:55 — forked from shedd/assets.rake
Check asset encoding for valid UTF-8
namespace :assets do
desc "Check that all assets have valid encoding"
task :check => :environment do
paths = ["app/assets", "lib/assets", "vendor/assets"]
extensions = ["js", "coffee", "css", "scss"]
paths.each do |path|
dir_path = Rails.root + path
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@rodrigo-lima
rodrigo-lima / gist:2631940
Created May 8, 2012 01:52
NSURLConnection + Basic Auth
@implementation WhateverClass
+ (NSString *)getBasicAuth
{
NSData *encodeData = [[NSString stringWithFormat:@"%@:%@", username, password]
dataUsingEncoding:NSUTF8StringEncoding];
// from NSData+Base64.m by Matt Gallagher
NSString *credentials = [encodeData base64EncodedString];
@caike
caike / template.rb
Created June 23, 2012 15:18
Rails 3.2.6 template w/ Twitter Bootstrap
app_name = ARGV[0]
initial_resource_name = ask('What is your initial resource ?')
remove_file 'Gemfile'
create_file 'Gemfile', <<-eos
source 'https://rubygems.org'
gem 'rails', '3.2.6'
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@jswanner
jswanner / migrate.rake
Last active April 1, 2021 22:05
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
@dch
dch / erlang.rb
Created June 24, 2013 22:13
homebrew install Erlang/OTP R16B01 via `brew install --with-openssl -v https://gist.github.com/dch/5854160/raw/erlang.rb`
require 'formula'
class ErlangManuals < Formula
url 'http://erlang.org/download/otp_doc_man_R16B01.tar.gz'
sha1 '57ef01620386108db83ef13921313e600d351d44'
end
class ErlangHtmls < Formula
url 'http://erlang.org/download/otp_doc_html_R16B01.tar.gz'
sha1 '6741e15e0b3e58736987e38fb8803084078ff99f'