Skip to content

Instantly share code, notes, and snippets.

View srabuini's full-sized avatar

Sebastian Rabuini srabuini

View GitHub Profile
@srabuini
srabuini / gist:4050005
Created November 10, 2012 05:11
Move elements a number (positive or negative) of steps and return it
class Array
def move(steps)
(steps % size).times { self << shift }; return self
end
end
ffmpeg -y -loop 1 -i sebas.jpg -r 20 -t 3 begin.mpg
@srabuini
srabuini / bitcoin.md
Created December 1, 2013 06:43
Bitcoin intro & notes
require 'rake'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'test'
t.libs << 'lib'
t.pattern = 'test/*_test.rb'
end
task default: :test
class WestheimerRule
UNITS = %i(seconds minutes hours days weeks months years lustra decades
centuries millennniums)
def initialize(time:, unit:)
@time = time
@unit = unit
end
def estimate
@srabuini
srabuini / app.rb
Last active December 29, 2015 11:03
class App
REQUEST_METHOD = 'REQUEST_METHOD'.freeze
PATH_INFO = 'PATH_INFO'.freeze
attr_reader :env
def initialize(routes)
@routes = routes
@h = Hart.new(@routes)
end
atom.commands.add 'atom-workspace', 'sebas:remove-comments', ->
editor = atom.workspace.getActivePaneItem()
buffer = editor.getBuffer()
buffer.replace /^(#| +#).*\n/g, ''
.PHONY: test
test:
@ruby -Ilib:test test/runner.rb "test/*_test.rb"
watch:
fswatch -0 -l0.1 ./lib/*.rb ./test/*.rb | xargs -0 -I {} make test
ARGV.select do |argument|
case argument
when /\*/ then
Dir.glob(argument).each do |file|
require File.expand_path(file)
end
else
require File.expand_path(argument)
end
end
'.text.html':
'Make a label tag':
'prefix': 'lab'
'body': '<%= f.label :$1 %>'
'New scaffold :new':
'prefix': 'new'
'body': """
<div class="page-header">
<%= link_to ${1:resource}_path, class: \'btn btn-default pull-right\' do %>
<span class="glyphicon glyphicon-list-alt"></span>Volver