This file contains hidden or 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
# https://www.xkcd.com/936/ | |
module Clave | |
extend self | |
def run | |
puts((1..4).map { safe_words.sample }.join(" ")) | |
end | |
private |
This file contains hidden or 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
# env_vars.rb | |
puts "A:#{ENV["AAA"]}" | |
puts "B:#{ENV["BBB"]}" | |
puts "C:#{ENV["CCC"]}" | |
puts "D:#{ENV["DDD"]}" |
This file contains hidden or 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
# countries on sepa | |
sepa = %w(AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV | |
MC MT NL NO PL PT RO SE SI SK SM) | |
# config file from iso-iban gem | |
file = File.read(File.join('data','iso-iban', 'specs.yaml')) | |
config = YAML.load(file) | |
# sepa countries with missing branch positions | |
missing = config.select do |code, values| |
This file contains hidden or 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
alias dk=docker | |
alias dc=docker-compose | |
alias dra='dc run app' | |
alias drabe='dc run app bundle exec' | |
alias drake='dc run app bundle exec rake' | |
alias drails='dc run app bundle exec rails' | |
# alias dea='docker-compose exec app' | |
alias deabe='dea bundle exec' |
This file contains hidden or 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
alias bash='bash --login' | |
alias ls='ls --color' | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias t='tailf' | |
alias c='ccze -A' | |
alias ag='ack-grep' | |
alias g='git' | |
alias e='gvim ' |
This file contains hidden or 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
#include <stdint.h> | |
const uint8_t fib_symbol[] = { | |
0x52,0x49,0x54,0x45,0x30,0x30,0x30,0x32,0xb2,0xe1,0x00,0x00,0x01,0x52,0x4d,0x41, | |
0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x01,0x34,0x30,0x30, | |
0x30,0x30,0x00,0x00,0x00,0xbb,0x00,0x03,0x00,0x07,0x00,0x01,0x00,0x00,0x00,0x1a, | |
0x01,0x80,0x00,0x48,0x02,0x00,0x00,0xc0,0x01,0x80,0x00,0x46,0x01,0x80,0x00,0x91, | |
0x01,0x80,0x80,0x20,0x00,0x80,0xc0,0x01,0x01,0x80,0x00,0x06,0x02,0x00,0x00,0x3d, | |
0x02,0x80,0x00,0x06,0x03,0x40,0x13,0x83,0x02,0x80,0x00,0xa0,0x02,0x01,0x40,0x3e, | |
0x01,0x80,0xc0,0xa0,0x01,0x80,0x00,0x91,0x01,0x80,0x80,0x20,0x02,0x00,0x40,0x01, | |
0x01,0x81,0x00,0xae,0x01,0x00,0xc0,0x01,0x01,0x80,0x00,0x06,0x02,0x00,0x01,0x3d, |
This file contains hidden or 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' | |
class JsonFileCache | |
def initialize(path = nil) | |
@path = path || "/tmp/cache/#{SecureRandom.uuid}" # safe default | |
end | |
# Retrieves whole cache or single record if key is provided | |
def get(key = nil) | |
@cache ||= load_file |
This file contains hidden or 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
# to be called: | |
# ExampleService[1, {some: 'opt'}] | |
class ExampleService < Services::Base | |
# customize your setup | |
def initialize(concrete, arguments = {}) | |
@concrete = concrete | |
@arguments = arguments | |
end | |
# customize your processing |
This file contains hidden or 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
class Bottles | |
def song | |
verses(99, 0) | |
end | |
def verse(n) | |
<<-END | |
#{bottles(n).capitalize} on the wall, #{bottles(n)}. | |
#{what_now(n)}, #{bottles(n-1)} on the wall. |
This file contains hidden or 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
source 'https://rubygems.org' | |
ruby '2.3.0' | |
gem 'sinatra' |