Skip to content

Instantly share code, notes, and snippets.

View srabuini's full-sized avatar

Sebastian Rabuini srabuini

View GitHub Profile

Keybase proof

I hereby claim:

  • I am srabuini on github.
  • I am naitsabes (https://keybase.io/naitsabes) on keybase.
  • I have a public key ASB-9-9MGlwX1BgPPgdwTeG_NZn7lnQe5eZ6WA-G2ftgFQo

To claim this, I am signing this object:

@srabuini
srabuini / scrambler.rb
Created April 14, 2019 04:31
Generates a formula to scramble a Rubik's cube
#!/usr/bin/env ruby
module Scrambler
FACES = %w[B L D R U F].freeze
def self.run(steps)
directions = []
faces = []
steps.times do
'.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
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
.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
atom.commands.add 'atom-workspace', 'sebas:remove-comments', ->
editor = atom.workspace.getActivePaneItem()
buffer = editor.getBuffer()
buffer.replace /^(#| +#).*\n/g, ''
@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
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
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
@srabuini
srabuini / bitcoin.md
Created December 1, 2013 06:43
Bitcoin intro & notes