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
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>========== | |
0000 trace 1 ( 1) | |
0002 putspecialobject 1 | |
0004 putspecialobject 2 | |
0006 putobject :foo | |
0008 putiseq foo | |
0010 opt_send_simple <callinfo!mid:core#define_method, argc:3, ARGS_SKIP> | |
0012 pop | |
0013 trace 1 ( 4) | |
0015 putself |
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
# ____ ____ ____ ____ _________ ____ ____ ____ ____ | |
# ||R |||E |||A |||D ||| |||T |||H |||I |||S || | |
# ||__|||__|||__|||__|||_______|||__|||__|||__|||__|| | |
# |/__\|/__\|/__\|/__\|/_______\|/__\|/__\|/__\|/__\| | |
# ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ | |
# ||W |||A |||R |||N |||I |||N |||G |||! |||! |||! || | |
# ||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|| | |
# |/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\| | |
# |
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
#!/bin/bash | |
set -e | |
# Check for nsenter. If not found, install it | |
boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter' | |
# Use bash if no command is specified | |
args=$@ | |
if [[ $# = 1 ]]; then | |
args+=(/bin/bash) |
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 | |
require 'redis' | |
# Clear a large number of keys matching a pattern using SCAN and | |
# pipelining to avoid killing the server. | |
class ClearKeys | |
def initialize(pattern, host='localhost', postprocess_pattern=nil) | |
@redis = Redis.new(host: host) | |
@pattern = pattern |
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 | |
require 'redis' | |
# Clear a large number of keys matching a pattern using SCAN and | |
# pipelining to avoid killing the server. | |
class ClearKeys | |
def initialize(pattern, host='localhost', postprocess_pattern=nil) | |
@redis = Redis.new(host: host) | |
@pattern = pattern |
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
alias.br branch | |
alias.bra branch -a | |
alias.check diff --check | |
alias.ci commit -v | |
alias.cl clone | |
alias.co checkout | |
alias.com checkout master | |
alias.cp cherry-pick | |
alias.d diff | |
alias.dc diff --cached |
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 randys_version(current_url) | |
e = ->(e) { e.tr "A-Za-z", "N-ZA-Mn-za-m" } | |
vs = [freak=e.('ue_fhvgr'),e.('nccyvpnag_cbegny')] | |
z = ->(w,i) { w.split(e.('_'))[i] } | |
ks = vs.map.with_index {|zi,i| z.(zi,i) } | |
Hash[ks.zip(vs)][current_url] || vs[1] | |
end | |
booty = ->(t) { t ? nil : throw(:whoops) } | |
booty.call randys_version 'portal' == 'applicant_portal' |
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
$ irb | |
irb(main):001:0> class WhoIsAwesome | |
irb(main):002:1> YOU_ARE = " | |
irb(main):003:1" .-. . . . .-. .-. .-. . . .-. | |
irb(main):004:1" |-| | | | |- `-. | | |\/| |- | |
irb(main):005:1" ` ' `.'.' `-' `-' `-' ' ` `-' " | |
irb(main):006:1> define_method(YOU_ARE) do | |
irb(main):007:2* puts "This is insane" | |
irb(main):008:2> end | |
irb(main):009:1> end |