I hereby claim:
- I am yb66 on github.
- I am iainb (https://keybase.io/iainb) on keybase.
- I have a public key ASBMPFBvFnJ5Uzq_5zUgktL0pK8uomtYcnFoVATS5iC6xgo
To claim this, I am signing this object:
require 'sinatra' | |
require 'haml' | |
class Something | |
def self.all( h= {} ) | |
[] | |
end | |
def self.get( id=1 ) | |
obj = Object.new | |
class << obj |
require 'sinatra' | |
configure :development do | |
set :one, 1 | |
end | |
configure :production do | |
set :one, 11 | |
end |
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'pathname' | |
require 'psych' | |
options = {} | |
optparse = OptionParser.new do |opts| |
# Implemented because Syncthing (kind of) uses it | |
# @example | |
# @luhn = Luhn.new Base32.table | |
# @luhn.check_character "P56IOI7MZJNU2" | |
# # => "S" | |
class Luhn | |
def initialize alphabet | |
@alphabet = alphabet | |
@table_alpha = Hash[ @alphabet.split(//).zip(0 .. @alphabet.length - 1) ] | |
@table_code = Hash[ (0 .. @alphabet.length - 1).zip(@alphabet.split(//))] |
I hereby claim:
To claim this, I am signing this object:
-----BEGIN CERTIFICATE----- | |
MIIEbjCCAtagAwIBAgIBATANBgkqhkiG9w0BAQsFADAwMS4wLAYDVQQDDCVoZWxw | |
ZnVsLWlhaW4vREM9dGhlcHJpbnRlZGJpcmQvREM9Y29tMB4XDTE5MDExNTA3MjAw | |
OVoXDTIwMDExNTA3MjAwOVowMDEuMCwGA1UEAwwlaGVscGZ1bC1pYWluL0RDPXRo | |
ZXByaW50ZWRiaXJkL0RDPWNvbTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoC | |
ggGBALhp1KlrdriWAuhXhM3I0oZblbOUAgk8UZSyI6vLQ4oK8uHWmdBkrzUublq4 | |
7cU1T0IIFeKOzjN2aXS660q2Ev7Bpwt1oBjMVqLMZYJM4gixwzXW9labQhnjefEy | |
CTWRa/i4gL8NbwOg/UeX5rHiCy/xaqyxj//24E7m5e72JrpK11ZZ5/4TUvxDfOJr | |
w+16BAxH3ELBRjXoOXnlb7SzA2ohNnwuoom5gi9Ju6z0ooSa9cegqauHBbme8wgO | |
5bPwGi+MbiLKoMDcnakuUoKqWL6qA+/QofNnrmtgBmMe08dd9/ermztT/dBdNQiE |
require 'benchmark' | |
count = 1_000_000 | |
Benchmark.bmbm do |bm| | |
bm.report("to_s + ") { count.times { 11.to_s + '/' + 12.to_s } } | |
bm.report("+ ") { count.times { "11" + '/' + "12" } } | |
bm.report('#{} to_s ') { count.times { "#{11}/#{12}" } } | |
bm.report('#{} ') { count.times { %Q!#{"11"}/#{"12"}! } } | |
bm.report("to_s << ") { count.times { 11.to_s << "/" << 12.to_s } } | |
bm.report("<< ") { count.times { "11" << "/" << "12" } } |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<!-- Run the cacert refresh once a week --> | |
<!-- ~/Library/LaunchAgents/cacert-refresh.plist --> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>cacert-refresh</string> | |
<key>EnableGlobbing</key> |
# Because I don't like being tracked by Facebook around the web | |
# This function, which I load via my ~/.zshrc, | |
# - takes the url on the clipboard (when run) | |
# - decodes the querystring to find the original link | |
# - removes the FB id from the resulting query string | |
# - pops it back onto the clipboard | |
fb-uri(){ | |
str=${1:-`pbpaste`} | |
ruby -W0 -ruri -r'rack/utils' -e "print URI(Rack::Utils.parse_query(URI('$str').query)['u']).then{|uri| %Q(#{uri.scheme}://#{uri.host}#{uri.path}#{ (hs = Rack::Utils.parse_query(uri.query).reject{|k,_| k == 'fbclid'}).empty? ? '' : %Q(?#{Rack::Utils.build_query hs}) }) }" | pbcopy | |
} |