Skip to content

Instantly share code, notes, and snippets.

View rgm's full-sized avatar

Ryan McCuaig rgm

View GitHub Profile
{
"bookedQuantity": 1,
"cargoMeasurement": "PCS",
"cargoReference": 119934,
"cargoQuantity": 1,
"charterer": 10171228,
"commodity": 17890391,
"dimensionMeasurement": "M",
"freightCurrency": "USD",
"freightMeasurement": "PCS",
❯ pod install
Setting up CocoaPods master repo
[!] There was an error reading '/Users/rgm/.cocoapods/repos/master/CocoaPods-version.yml'.
Please consult http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/ for more information.
❯ pod setup
Setting up CocoaPods master repo
First, rewinding head to replay your work on top of it...
Fast-forwarded master to 041e73f076dd60b788bc4f2676532e234f892b8d.
From https://github.com/CocoaPods/Specs
#!/usr/bin/env xcrun swift
protocol SomeType { }
extension SomeType {
func maybeGreeting(noReally: Bool) -> String? {
return (noReally ? "howzit" : nil)
}
}
require 'test_helper'
class PermanentRedirectTest < ActionDispatch::IntegrationTest
# in all cases, no matter how byzantine the setup, the goals are:
# 1. get new episodes without the user having to re-subscribe
# 2. don't fire out duped episodes if we can help it.
test "gentlemanly df-style itunes redirect" do
podcast = create_itunes_redirected_podcast \
# https://www.youtube.com/watch?v=FITJMJjASUs
puts ->() {
pred = ->(n) { n - 1 } # let's pretend no operators
fact_improver = ->(partial) {
->(n) { n.zero? ? 1 : n * partial.(pred.(n)) }
}
def login_as (tenant, role)
unless $logged_in_as == [tenant, role]
step 'I am on the login page'
step 'I sign in as a ' + tenant + ' ' + role
step 'I click "Log In"'
step 'I sign in as a ' + tenant + ' ' + role
step 'I click "Log In"'
find 'div.dashboard'
$logged_in_as = [tenant, role]
end
@rgm
rgm / gist:e670f333ae91553031a8
Last active November 10, 2023 21:33
FizzBuzz in the untyped λ-calculus, as approximated by Ruby stabby procs. courtesy of @tomstuart.
-> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }]
} [-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }]
}[l]][x] [-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { ->
y { y } }] } [l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p {
p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f {
f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l {
-> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { ->
f { f[x][y] } } } [x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y]
}] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { ->
n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n {
@rgm
rgm / arith.rb
Last active August 29, 2015 14:06
TAPL ch. 3, but with more Ruby!
# The untyped calculus of booleans and numbers
#
# TaPL, Pierce 2002, ch. 3 & 4
#
# IRB examples:
#
# if true then false else 0
# arith_eval make_if(predicate: make_yep, consequent: make_nope, alternative: make_zero)
# => nope
#

Keybase proof

I hereby claim:

  • I am rgm on github.
  • I am rgm (https://keybase.io/rgm) on keybase.
  • I have a public key whose fingerprint is 0CD9 C99D 37E0 3EA1 B9BD 4BC2 8E4A CF9B DAC2 D396

To claim this, I am signing this object:

@rgm
rgm / .vimrc
Last active August 29, 2015 14:04
Alternate file finder for Meteor
function! MeteorOpenAlternate(opener, type)
let alternate = system("meteor_find_alternate " . expand("%:p") . " " . a:type)
execute a:opener . " " . alternate
endfunction
nnoremap <leader>mU :call MeteorOpenAlternate("e", "test")<CR>
nnoremap <leader>mu :call MeteorOpenAlternate("vsplit", "test")<CR>
nnoremap <leader>mT :call MeteorOpenAlternate("e", "template")<CR>
nnoremap <leader>mt :call MeteorOpenAlternate("vsplit", "template")<CR>