I hereby claim:
- I am eljojo on github.
- I am eljojo (https://keybase.io/eljojo) on keybase.
- I have a public key whose fingerprint is 4ACE 2687 33CD 4307 D826 059F F1FA 10B3 6B3A 8FC7
To claim this, I am signing this object:
# Using the information extracted from an AST Tree, so we can do something meaningful with it. | |
# this needs https://github.com/whitequark/parser | |
require 'parser/current' | |
op = "(a > 3) or (a == b) or ((b > 3.months) and (c =~ 'd')) or jojo?" | |
parsed = Parser::CurrentRuby.parse(op) | |
def clean_begin(node) | |
return node unless node.type == :begin | |
raise "begin has more than one children!" if node.children.length > 1 |
$savings_per_year = 300.0 | |
seconds_in_a_year = 3600 * 24 * 365 | |
$money = $savings_per_year/seconds_in_a_year | |
elapsed_seconds = 0.0 | |
loop do | |
puts("you just lost %.9f euros by not switching your electricity company" % ((elapsed_seconds += 1) * $money)) | |
sleep 1 | |
end |
class SimpleQueue | |
def initialize(name) | |
@name = name.to_sym | |
end | |
def push(items) | |
return unless items.present? | |
items = [items] unless items.is_a?(Array) | |
with_redis do |redis| | |
redis.sadd(redis_key, items.map(&:to_s)) |
class DaWorker | |
include Sidekiq::Worker | |
def perform | |
sleep(10) | |
end | |
class << self | |
def queue_name | |
sidekiq_options_hash["queue"].to_s || "default" |
int rojor = 2; | |
int blancof = 4; | |
int valiza = 5; | |
int parlante = 8; | |
int cuenta = 0; | |
int distancia = 0; | |
int estado = 0; // cuando estado == 1, esta prendido, == 0, esta apagado | |
//----------------------ARDUMOTO-------------------------// | |
#define derecha 0 // |
def sing(number) | |
puts "#{number} bottles of beer on the wall," | |
puts "#{number} bottles of beer." | |
puts "Take one down, pass it around," | |
puts "#{number - 1} bottles of beer on the wall." | |
end | |
99.downto(1).each do |number| | |
sing(number) | |
end |
I hereby claim:
To claim this, I am signing this object:
A stupidly simple implementation of a kind of "sorta immutable" struct that can be instantiated as conveniently as an OpenStruct
but after instantiation it doesn't let me (easily) add fields or mutate them:
guy = ClosedStruct.new( name: "John", age: 23 )
# readers:
guy.name #=> "John"
guy.age #=> 23
class String | |
def each_match(regex) | |
result = [] | |
position = 0 | |
while match_data = regex.match(self, position) do | |
result << if block_given? then yield(match_data) else match_data end | |
position = match_data.end(match_data.size - 1) | |
end | |
show_frown_gif = -> | |
@result.html $('<img>').attr('src', 'http://mrwgifs.com/wp-content/uploads/2013/07/Zooey-Deschanels-Cute-Sad-Frown.gif') |