Skip to content

Instantly share code, notes, and snippets.

@TylerBrock
TylerBrock / method_definition_call_bench.rb
Last active December 17, 2015 14:49
Ruby Method Call Speed based on Definition Strategy
require 'benchmark/ips'
GC.disable
class Foo
def baz; end
define_method(:foo) { }
class_eval 'def bar; end'
end
var http = require('http');
// The url we want, plus the path and options we need
var options = {
host: 'localhost',
port: 8124,
path: '/?file=secondary',
method: 'GET'
};
@TylerBrock
TylerBrock / munge.sh
Created December 3, 2015 18:54
Script to strip enclosing results from Parse data
for file in *.json; do
jq '.results' < "$file" > "$file.scrubbed"
mv "$file" "`basename $file .scrubbed`"
done
source :rubygems
gem 'json'
gem 'rake', :require => ['rake/testtask']
gem 'rake-compiler', :require => ['rake/extensiontask', 'rake/javaextensiontask']
gem 'activesupport'
group :deploy do
gem 'git'
gem 'yard'
@TylerBrock
TylerBrock / 0-readme.md
Created November 26, 2012 13:49 — forked from burke/0-readme.md
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.

@TylerBrock
TylerBrock / gemspec-usage.md
Created November 8, 2012 01:47 — forked from holman/gemspec-usage.md
test/spec/mini

Just install this in your apps like so:

gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'

@TylerBrock
TylerBrock / rbenv-install-system-wide.sh
Created September 21, 2012 14:14 — forked from jnx/rbenv-install-system-wide.sh
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@TylerBrock
TylerBrock / gist:3761635
Created September 21, 2012 14:03 — forked from olistik/gist:2627011
Ubuntu 12.04 setup (rbenv, janus, postgres)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git
  • Copy/paste from the command line:
sudo apt-get install xclip
@TylerBrock
TylerBrock / Gemfile
Created September 19, 2012 04:12
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@TylerBrock
TylerBrock / mac-app.rb
Created September 12, 2012 18:14 — forked from havenwood/mac-app.rb
Create an OS X .app Executable With Your Choice Of Language For Script
require 'builder'
module MacApp
class << self
def new
ask_name
ask_file_extension
ask_language
create_directories