Skip to content

Instantly share code, notes, and snippets.

View IvanTorresEdge's full-sized avatar
👨‍💻
full-on building mode and loving every minute of it

Ivan Torres IvanTorresEdge

👨‍💻
full-on building mode and loving every minute of it
View GitHub Profile
@IvanTorresEdge
IvanTorresEdge / mixin.rb
Created December 26, 2011 12:47
Ruby Mixin Template
module MixinSample
def self.included(recipient)
recipient.extend(ClassMethods)
recipient.class_eval do
include InstanceMethods
end
end
module InstanceMethods
end
@IvanTorresEdge
IvanTorresEdge / .rvmrc
Created December 27, 2011 06:31
Auto-generate gemset with RVM (.rvmrc)
rvm use 1.9.3@your_project_name --create
@IvanTorresEdge
IvanTorresEdge / run.sh
Created December 29, 2011 11:17
Update Vim bundles
sh update-bundles.sh
@IvanTorresEdge
IvanTorresEdge / gist:1562942
Created January 5, 2012 00:03
Verify your Rails environment
bundle exec ruby config/environment.rb
@IvanTorresEdge
IvanTorresEdge / gist:1574140
Created January 7, 2012 07:54
Install Specific Formula Version with Homebrew
# Update Homebrew so that /usr/local is converted to a git repository:
brew update
# Find for the specific revision that you need:
git log -S '0.9.9' Library/Formula/sphinx.rb
# Checkout the formula for that specific revision:
git checkout f4a925da5aee87cf7e2509116a495779a1af64b8 Library/Formula/sphinx.rb
# Install the desired version:
@IvanTorresEdge
IvanTorresEdge / all_erbs_2_haml.sh
Created January 13, 2012 04:06
Convert all my templates from ERB to HAML
#!/usr/bin/env sh
for f in `find app/views/ -name "*.erb"`
do
echo "processing $f"
out=`echo $f | sed "s/\.erb$/\.haml/"`
html2haml $f > $out
git add $out
git rm $f
done
@IvanTorresEdge
IvanTorresEdge / prime_numbers_sieve_eratosthenes.rb
Created February 2, 2012 06:45
Find prime numbers using Sieve of Eratosthenes algorithm (Ruby)
#!/usr/bin/env ruby
n = 2..1000
o = []
p = []
for i in n
next if o.include? i
ii = i * 2
while ii <= n.last do
@IvanTorresEdge
IvanTorresEdge / benchmarks.coffee
Created April 21, 2012 09:42
Benchmarking .each and .map functions from jQuery and Underscore.js
# Benchmarking .each and .map functions from jQuery and Underscore.js
#
# Requirements:
# npm install benchmark jquery underscore
Benchmark = new require('benchmark')
$ = require 'jQuery'
_ = require 'underscore'
@IvanTorresEdge
IvanTorresEdge / gist:2440091
Created April 21, 2012 22:50
Git: Delete already deleted files from repository
git status | grep deleted | cut -f2 | sed -e 's/deleted:\s*//g' | xargs git rm -f
@IvanTorresEdge
IvanTorresEdge / gist:2440120
Created April 21, 2012 22:54
Convert SAT Certificates from DER to PEM
# convert private key to PEM (removing password)
openssl pkcs8 -inform DER -in FOC080926i89_1104071356s.key -outform PEM -out FOC080926i89_1104071356s.pem
# extract public key
openssl rsa -in FOC080926i89_1104071356s.pem -pubout -out FOC080926i89_1104071356s.pub.pem