-
rice (type: Carnaroli or Arborio)
80-100 g
per person, total:~400 g
- a bit more if you're hungry
-
one onion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = 1000 | |
f1 = Proc.new { |x| x * x } | |
f2 = -> (func, int) { puts "the result is: '#{func.call(int)}', i is: '#{i}'" } | |
def run(range, operation, printer) | |
range.each do |i| | |
printer.call(operation, i) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
=begin | |
How to launch | |
$ chmod 700 rebooter.rb | |
$ ./rebooter.rb | |
It will create two files (will delete them on SIGTERM and SIGINT) | |
./rebooter.pid | |
./rebooter.control |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Issue on github: | |
# https://github.com/rack/rack/issues/337 | |
# | |
# Possible patch: | |
# https://gist.github.com/psychocandy/3130349 | |
# but I don't like the idea of monkeypatching the standard library | |
# | |
# Rack middleware: | |
# http://stackoverflow.com/questions/16269897/rails-argumenterror-invalid-encoding | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/core_ext/object/try' | |
module TryChain | |
def try_chain | |
@proxy = Proxy.new(self) | |
end | |
class Proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# impersonation_utilities.rb | |
require 'digest/md5' | |
module ImpersonationUtilities | |
SHARED_SECRET = "I'm a secret string!" | |
TOKEN_VALID_FOR_DAYS = 1 | |
class << self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
TABLE_FLIP = <<-EOS | |
(╯°□°)╯︵ ┻━┻ | |
EOS | |
alias_method :original_puts, :puts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_context(c) | |
@context = c | |
end | |
def context | |
@context | |
end | |
def with_context(cont, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SendMethodList | |
def send_method_list(*methods) | |
results = methods.map do |sym| | |
begin | |
self.send(sym) | |
rescue => error | |
error | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'securerandom' | |
REGEX = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])((?=.*[^\w])|(?=.*_))/ | |
def run | |
times = 0 | |
word = begin | |
times += 1 | |
SecureRandom.urlsafe_base64 |