Skip to content

Instantly share code, notes, and snippets.

View jaikoo's full-sized avatar
🗻
Working

Jonathan Conway jaikoo

🗻
Working
View GitHub Profile
# Tested on Ubuntu 13.04 x64
# You need to set those environment variables
#```
# export DATABASE_USER=username_here
# export DATABASE_PASSWORD=password_here
# export DATABASE_NAME=database_name_here
# export DATABASE_ROOT_PASSWORD=database_root_password
# ```
# ON SERVER
@jaikoo
jaikoo / miniskirt.rb
Created June 3, 2012 13:39 — forked from stephencelis/minifacture.rb
Factory girl, relaxed.
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
@jaikoo
jaikoo / underscoreR.coffee
Created May 7, 2012 08:40 — forked from jimtla/underscoreR.coffee
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
@jaikoo
jaikoo / gist:2576036
Created May 2, 2012 11:49 — forked from anarchivist/gist:1724852
Installing clamav gem on Mac OS X with Homebrew-installed clamav
$ env ARCHFLAGS='-arch x86_64' gem install clamav
Building native extensions. This could take a while...
ERROR: Error installing clamav:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for clamav.h... yes
checking for cl_engine_compile() in -lclamav... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
@jaikoo
jaikoo / es.sh
Created May 1, 2012 09:25 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.3.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
@jaikoo
jaikoo / 0-readme.md
Created January 31, 2012 17:47 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@jaikoo
jaikoo / generate_markets.rb
Created August 25, 2011 12:30 — forked from mbleigh/generate_markets.rb
The model and generation code to pull the 100 biggest US cities out as geographical models for a Rails app.
# Data culled from Wikipedia. Could be cleaner, but this is nice and simple.
major_cities = [["New York", "New York"], ["Los Angeles", "California"], ["Chicago", "Illinois"], ["Houston", "Texas"], ["Philadelphia", "Pennsylvania"], ["Phoenix", "Arizona"], ["San Antonio", "Texas"], ["San Diego", "California"], ["Dallas", "Texas"], ["San Jose", "California"], ["Jacksonville", "Florida"], ["Indianapolis", "Indiana"], ["San Francisco", "California"], ["Austin", "Texas"], ["Columbus", "Ohio"], ["Fort Worth", "Texas"], ["Charlotte", "North Carolina"], ["Detroit", "Michigan"], ["El Paso", "Texas"], ["Memphis", "Tennessee"], ["Baltimore", "Maryland"], ["Boston", "Massachusetts"], ["Seattle", "Washington"], ["Washington", "District of Columbia"], ["Nashville", "Tennessee"], ["Denver", "Colorado"], ["Louisville", "Kentucky"], ["Milwaukee", "Wisconsin"], ["Portland", "Oregon"], ["Las Vegas", "Nevada"], ["Oklahoma City", "Oklahoma"], ["Albuquerque", "New Mexico"], ["Tucson", "Arizona"], ["Fresno", "California"], ["Sacrame
#!/bin/bash
# Kill all my running EC2 instances at Amazon AWS - all regions
. ~/.ec2/env
cat <<EOF | while read EC2_URL
https://eu-west-1.ec2.amazonaws.com
https://ec2.us-east-1.amazonaws.com
https://ec2.us-west-1.amazonaws.com
https://ec2.ap-southeast-1.amazonaws.com
EOF
do
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Thu, 10 Jun 2010 00:46:48 -0400
Subject: [PATCH] async rails3
---
Gemfile | 6 ++++++
app/controllers/widgets_controller.rb | 6 ++++++
app/models/widget.rb | 2 ++
config.ru | 1 +
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#