Skip to content

Instantly share code, notes, and snippets.

def send_active_record_meths(meths, klass)
if meths.is_a?(Array)
meths.inject(klass) { |o,meth|
meth.symbolize_keys!
meth.inject(o) { |ob,m|
if m[1].is_a?(Hash)
m[1].symbolize_keys!
m[1].each do |k,v|
# symbolize associations
if k == :joins
@aaronlifton3
aaronlifton3 / app.rb
Created July 26, 2013 20:08 — forked from cpatni/app.rb
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
@aaronlifton3
aaronlifton3 / Preferences.sublime-settings
Created July 26, 2013 21:08
sublime settings for rails/work
{
"auto_indent": true,
"auto_match_enabled": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/zenburn/zenburn.tmTheme",
"draw_indent_guides": true,
"draw_white_space": "none",
"file_exclude_patterns":
[
package com.snowdale.play.extensions
import com.twitter.util.{ Future, Return, Throw , Duration}
import play.api.libs.concurrent._
import java.util.concurrent.TimeUnit
object Finagle {
implicit def futureTransform[A](future: Future[A]) = new FinagleFuture(future)
}
// Rewrite http://tour.golang.org/#63 to scala using Channel
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
object GO63Channel extends App {
def sum(a: List[Int], c: Channel[Int]) = future {
c write a.sum
}
val c = new Channel[Int]()
@aaronlifton3
aaronlifton3 / .slate
Last active December 23, 2015 05:09
slate 2013-ec
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@aaronlifton3
aaronlifton3 / es.sh
Last active December 23, 2015 09:49 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@aaronlifton3
aaronlifton3 / redis_install_centos.txt
Last active December 23, 2015 11:28 — forked from coder4web/redis_install_centos.txt
updated redis centos install script
But today we want to compile redis from source (see http://redis.io/download)
yum install make gcc tcl
cd /usr/local/src
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar xzf redis-2.6.16.tar.gz
cd redis-2.6.16
make
make test
make install