Skip to content

Instantly share code, notes, and snippets.

View futuremint's full-sized avatar

Dave Woodward futuremint

  • AED
  • Bozeman, MT
View GitHub Profile
@futuremint
futuremint / fizzbuzz.ts
Created May 22, 2020 19:57
FizzBuzz implemented in Typescript's type system
// FizzBuzz with Typescript Types
// from https://gal.hagever.com/posts/typing-the-technical-interview-in-typescript/
// B is a subset, or equal to A
type Eq<A, B extends A> = 'passes';
// test it out
type test_eq = [
Eq<'Hello', 'Hello'>,
// Eq<'Hello', 'world'> // <- type error
@futuremint
futuremint / gist:1092807
Created July 19, 2011 15:35
RVM upgrade environment problem
I upgraded ruby by typing "rvm upgrade ruby-1.9.2-p180 ruby-1.9.2-p290". I set default to the new one with "rvm --default use ruby-1.9.2-p290"
Except now when I open a new console, my rvm looks like this:
rvm info
ruby-1.9.2-p180:
system:
uname: "Linux fedora 2.6.38.7-30.fc15.i686.PAE #1 SMP Fri May 27 05:44:56 UTC 2011 i686 i686 i386 GNU/Linux"
begin
raise
rescue => e
puts e.backtrace[0..4].join("\n")
end
@futuremint
futuremint / really_hackish_spec_to_shoulda.el
Created April 20, 2009 20:50 — forked from jnunemaker/really_hackish_spec_to_shoulda.rb
Translates RSpec to Shoulda in your current Emacs buffer (tested in GNU Emacs only)
(defun rspec-to-shoulda ()
"Translates RSpec code to Shoulda
NOTE: You still have to wrap the results in a Test::Unit class"
(interactive)
(dolist (pair '(("\\(require\s.*/\\)\\([a-z_]+\\)'$" "\\1test_helper'") ;; require
("describe\s" "context ") ;; RSpec -> Shoulda syntax
("it\s" "should ")
("\s\"should\s" " \"")
("before\s" "setup ")
("before(:each)\s" "setup ")