Skip to content

Instantly share code, notes, and snippets.

View fgalassi's full-sized avatar

Federico Galassi fgalassi

View GitHub Profile
@fgalassi
fgalassi / git_svn_update_all.sh
Created August 23, 2012 16:16
Update git-svn repository and externals
#!/bin/sh
root=`git rev-parse --show-toplevel`
echo "Moving to root: $root"
cd $root
echo "Rebasing current directory"
git svn rebase
echo "Looking for externals"
@fgalassi
fgalassi / gist:3393132
Created August 19, 2012 07:15
Ruby Koan triangle_2 project
def triangle(*sides)
raise TriangleError if [
sides.count != 3,
sides.any? {|side| side < 1},
sides.max >= sides.reduce(:+) - sides.max
].any?
case sides.uniq.count
when 1 then :equilateral
when 2 then :isosceles
else :scalene
@fgalassi
fgalassi / README
Created May 10, 2012 23:13 — forked from shayarnett/README
Snippet generator for RubyMotion ctags (UltiSnips)
Generate ctags with `rake ctags`
Run snipper.rb
Move motion.snippets into ~/.vim/UltiSnips/ruby/
var Compose = require("compose")
var livingThing = Compose({
alive: false,
isDead: function() {
return !this.alive
},
isAlive: function() {
return this.alive
},
module Enumerable
class MapEnumerator
instance_methods.each {|m| undef_method m unless m =~ /__/}
def initialize(enum)
@enum = enum
end
def method_missing(name, *args)
@enum.map {|e| e.send name, *args}