Skip to content

Instantly share code, notes, and snippets.


Marc Riera mrcasals

Block or report user

Report or block mrcasals

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
IanVaughan /
Created Jun 9, 2012
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
gem list
gem install bundler
avdi / class-reloading.rb
Created Jun 12, 2012
Class reloading breaks type-checking
View class-reloading.rb
class Foo
Foo.object_id # => 34581480
f = # => #<Foo:0x000000041f53c0>
f.class.object_id # => 34581480
# This just prevents the "const redefined" warning

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
andkerosine / raskell.rb
Created Aug 15, 2012
Haskell-like list comprehensions in Ruby
View raskell.rb
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
class Array
def +@
nihilismus /
Last active Jan 30, 2017
chruby + ruby-build / mksh

chruby + ruby-build / mksh

  1. Install chruby and ruby-build with git. I keep their repo at ~/.chrb, their installation inside ~/local and my rubies at ~/.chrb/rubies.
  2. Copy this in your ~/.mkshrc file
# chruby + ruby-build
chrb() {
    source ~/local/share/chruby/
    unset RUBIES
    RUBIES=$(ls -d ~/.chrb/rubies/* 2> /dev/null)
chriscoyier / index.html
Created Jun 6, 2013
A CodePen by Chris Coyier. Track form progress with <progress> - Like a simple version of gamification.
View index.html
<form accept-charset="UTF-8" action="#" class="pro-form" id="pro-form" method="post">
<h1>Progress Form</h1>
<div class="progress-wrap">
<progress max="100" value="0" id="progress"></progress>
<div class="progress-message" id="progress-message">The form, it wants you.</div>
<input id="subscription_plan_id" name="subscription[plan_id]" type="hidden" value="1">
txus / .pryrc.rb
Last active Dec 18, 2015
Pry command to trace a method invocation and log backtraces of each invocation to a file.
View .pryrc.rb
def write_backtrace name, backtrace, filename
exceptions = Regexp.union([
backtrace.reject! { |line| line =~ exceptions }
peterc / methods_returning.rb
Last active Aug 14, 2017
Object#methods_returning - to work out which method on an object returns what we want
View methods_returning.rb
require 'stringio'
require 'timeout'
class Object
def methods_returning(expected, *args, &blk)
old_stdout = $>
$> = do |meth|
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false
bitemyapp / gist:8739525
Last active Dec 3, 2019
Learning Haskell
View gist:8739525

rage-quit plugin for oh-my-zsh

based on rage-quit support for bash


Put the files below inside ~/.oh-my-zsh/custom/plugins/fuck

Also chmod a+x the flip command.

You can’t perform that action at this time.