Skip to content

Instantly share code, notes, and snippets.

View edgar's full-sized avatar

Edgar Gonzalez edgar

View GitHub Profile
@edgar
edgar / pry_console
Created February 6, 2014 17:20
Rails 2.3.* console using Pry
#!/usr/bin/env ruby
console = File.expand_path(File.dirname(__FILE__), '.') + "/script/console"
exec console, *ARGV, '--irb=pry'
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@edgar
edgar / gist:9900527
Created March 31, 2014 19:41
keybase.md
### Keybase proof
I hereby claim:
* I am edgar on github.
* I am edgar (https://keybase.io/edgar) on keybase.
* I have a public key whose fingerprint is 45A6 D897 81CD ABBC A678 8C57 4599 5010 176C F6BF
To claim this, I am signing this object:
@edgar
edgar / .pryrc
Created June 17, 2014 17:54
.pryrc file to customize Pry
Pry.config.editor = 'subl3 -n -w'
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
def unbundled_require(gem)
loaded = false
if defined?(::Bundler)
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@edgar
edgar / ruby_gc.sh
Last active August 29, 2015 14:23 — forked from mikhailov/ruby_gc.sh
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@edgar
edgar / polycorn.md
Last active August 29, 2015 14:26 — forked from octplane/polycorn.md
Life and Death of Unicorns The introduction of our Unicorn management tool, Polycorn. This gists contains the original article about Polycorn plus the source code of Polycorn.

Life and death of Unicorns

The introduction of our Unicorn management tool, Polycorn.

jump into our train!

Photo by Protohiro from Flickr

At Fotopedia, we use Unicorn to serve our main Rails application. Every day, we restart our application several times, spawning and killing hundred of Unicorns. Managing graceful restarts is a complex task, and requires careful monitoring and command. This article introduces our tool Polycorn, a Unicorn management program.

[[MORE]]

@edgar
edgar / git_svn_bash_prompt.sh
Created October 31, 2010 22:55 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to ruby version and git/svn branch, and return status of last command
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the ruby version
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
@edgar
edgar / git_svn_bash_prompt
Created August 22, 2011 14:46
Set the bash prompt according to: branch/status of the current git/svn repository, rvm/ruby version and gemset used
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git/svn repository
# * the return value of the previous command
# * the current rvm ruby version and gemset (or plain ruby, check parse_ruby_version function)
#
# USAGE:
class Photo
include Mongoid::Document
include Mongoid::Timestamps
referenced_in :stream
set_callback(:destroy, :after) do |document|
document.update_stream
end
def update_stream