Skip to content

Instantly share code, notes, and snippets.

@fguillen
fguillen / git_tips.md
Created December 19, 2010 20:53
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@KL-7
KL-7 / one-liners.md
Created January 10, 2012 19:49
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@agibralter
agibralter / culerity-hooks.rb
Created April 2, 2010 18:31
Cucumber hooks for culerity + rvm
Before("@culerity,@celerity,@javascript") do |scenario|
unless @env_rvm_jruby
@env_rvm_jruby = {}
require 'yaml'
rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`).values.first
rvm_info['environment'].each do |k, v|
@env_rvm_jruby[k] = v
end
@env_jruby_path = rvm_info['binaries']['ruby'].gsub(%r{^(.*)/ruby$}, '\1')
end
@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@likethesky
likethesky / elixirphoenix.bash
Last active January 5, 2022 10:00
Installing Elixir & the Phoenix framework with Homebrew on OS X
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez
@unak
unak / history.txt
Last active November 29, 2021 01:40
The History of Ruby
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@oriolgual
oriolgual / elastic_search_indexer.rb
Created March 22, 2013 11:01
Companion gist for my talk about using ElasticSearch with Ruby.
# Public: A module to be mixed in another class with common methods to index
# records in ElasticSearch.
#
# The host object needs to respond to 'indexed_attributes', which will return
# an array of the attributes names to be indexed.
#
# It's also recommended to override the 'save?' method to make sure only
# records that match some specifications are indexed.
#
# The type used for the ElasticSearch index will be extracted from the name of
@jbgo
jbgo / debug_system_stack_error.md
Created January 9, 2013 15:08
debug SystemStackError in ruby 1.9

This is how I debug SystemStackError when there is no stack trace.

My first attempt was:

begin
  a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
  puts caller
end
@mattetti
mattetti / tracepoint_middlware.rb
Created March 6, 2013 06:34
test middleware for Ruby 2.0 logging the method dispatches going on when a request is being handled.
class TracePoint
class Middleware
def initialize(app)
@app = app
end
def call(env)
stats = {}
trace = TracePoint.new(:call) do |tp|