Skip to content

Instantly share code, notes, and snippets.

View lsaffie's full-sized avatar

Luis Saffie lsaffie

View GitHub Profile
#!/bin/bash
# One stop-shop to install rbenv, friends and ruby 1.9.3
# Author: Luis Saffie <luis@saffie.ca>
# USAGE: curl https://gist.github.com/lsaffie/6258406/raw/rbenv-ubuntu-install |bash
echo "========================="
echo "remove rvm"
echo "========================="
@lsaffie
lsaffie / translator.rb
Last active December 12, 2015 00:19 — forked from vraravam/translator.rb
#!/usr/bin/env ruby
if ARGV.size != 2
puts "Usage: #{$0} <from_language> <to_language>"
exit -1
end
require 'rubygems'
require 'ya2yaml' # this gem is needed for this to work!
require 'yaml'
@lsaffie
lsaffie / pre-commit
Created August 5, 2012 20:00
pre-commit git hook that checks for values in the FORBIDDEN array
#!/bin/bash
# Pre commit hook that prevents FORBIDDEN code from being commited.
# Add unwanted code to the FORBIDDEN array as necessary
FILES_PATTERN='\.(rb|js|coffee)(\..+)?$'
FORBIDDEN=( debugger ruby-debug )
for i in "${FORBIDDEN[@]}"
do
@lsaffie
lsaffie / gist:3202888
Created July 30, 2012 00:27
mail gem usage. Checking mail and reading attachemtns
require 'mail'
def create_observations(file)
#Here's were we create observations based on the file
end
Mail.defaults do
retriever_method :pop3, :address => "pop.gmail.com",
:port => 995,
:user_name => "email@gmail.com",
#!/bin/bash
#bash script to setup rbenv in one shot.
#And as a bonus, I've thrown in bundler
sudo apt-get -y install git-core curl
curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile