Skip to content

Instantly share code, notes, and snippets.

View supaspoida's full-sized avatar

Lar Van Der Jagt supaspoida

View GitHub Profile

Keybase proof

I hereby claim:

  • I am supaspoida on github.
  • I am lar_threeflow (https://keybase.io/lar_threeflow) on keybase.
  • I have a public key ASDBhimRec7VD8pth-JHD7W9cd2T8g2QibZI_vZN5MoQPgo

To claim this, I am signing this object:

@supaspoida
supaspoida / package.json
Created December 1, 2021 21:55 — forked from kentcdodds/package.json
setup script for my workshops
{
"name": "workshop-setup",
"version": "1.0.0",
"description": "This is the common setup script for most of my workshops",
"bin": "./setup.js"
}

Keybase proof

I hereby claim:

  • I am supaspoida on github.
  • I am supaspoida (https://keybase.io/supaspoida) on keybase.
  • I have a public key ASBKoqZkerJrbG5V94B4ECPiNI4hvBFyKkqsUk_FYTZaFQo

To claim this, I am signing this object:

@supaspoida
supaspoida / pig_latin_spec.rb
Created June 28, 2017 17:04
Translate Phrases to Pig Latin
require 'spec_helper'
module PigLatin
extend self
def translate(phrase)
words = phrase.scan(/\w+/)
translations = words.map { |word| [word, Translate[word]] }
translations.inject(phrase) do |template, (original, translated)|
template.gsub(original, translated)

Hello

@supaspoida
supaspoida / named_block.rb
Last active December 17, 2015 13:59
Symbol#to_proc_with_hash_support
def key(k)
->(obj) { obj[k] }
end
[{ this: 'that' }].map &key(:this)
@supaspoida
supaspoida / hanoi.rb
Created February 2, 2013 02:58
brute force towers of hanoi
towers = [[nil,4,3,2,1],[nil],[nil]]
valid = [[nil],[nil],[nil,4,3,2,1]]
moves = []
record = ->(disc, from, to) {
names = { 0 => 'left ', 1 => 'center', 2 => 'right ' }
moves << "disc %s: %s -> %s" % [disc, names[from], names[to]]
}
mod3 = ->(i) { (i % 3).zero? }
mod5 = ->(i) { (i % 5).zero? }
both = ->(i) { mod3[i] && mod5[i] }
rules = {
'FizzBuzz' => ->(i) { both[i] },
'Fizz' => ->(i) { mod3[i] },
'Buzz' => ->(i) { mod5[i] }
}
@supaspoida
supaspoida / view_models.rb
Created October 15, 2012 18:47
Trivial example of a view model using dependency injection to access view context
class Controller
expose(:person) { PersonView.new(Person.first, self) }
end
class Decorator
attr_reader :controller, :object
def initializer(object, controller)
@object, @controller = object, controller
end
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind r source-file ~/.tmux.conf