Skip to content

Instantly share code, notes, and snippets.

Taylor Fausak tfausak

Block or report user

Report or block tfausak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tfausak
tfausak / class-comparison.rb
Last active Aug 29, 2015
A rundown of the many ways to compare classes in Ruby.
View class-comparison.rb
# coding: utf-8
require 'rspec' # 2.14.1
# NOTE: "include?" and "included_modules" are for modules only.
CLASS_METHODS = %i(
!=
<
<=
<=>
@tfausak
tfausak / Main.hs
Created May 29, 2014
A simple example of FFI in Haskell using the standard library, a source file, and a library.
View Main.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Main (main) where
import Foreign.C.Types (CDouble (..))
foreign import ccall safe "math.h sin" c_sin :: CDouble -> CDouble
foreign import ccall safe "public.h square" c_square :: CDouble -> CDouble
foreign import ccall safe "private.h half" c_half :: CDouble -> CDouble
@tfausak
tfausak / Swifty8.swift
Last active Aug 29, 2015
2048 implemented in Swift via Haskell.
View Swifty8.swift
// http://taylor.fausak.me/2014/04/28/cloning-2048-in-haskell/
import func Cocoa.rand
/*
Utilities
*/
// TODO: Can this be generalized to allow anything addable?
func combine(array: Int[]) -> Int[] {
@tfausak
tfausak / hs2048.hs
Created Jun 16, 2014
Difference between blog post and Hs2048.
View hs2048.hs
import Data.List (group)
import Data.Maybe (isJust)
import Data.Monoid ((<>))
empty :: Int -> [Maybe Int]
empty = flip replicate Nothing
shift :: [Maybe Int] -> [Maybe Int]
shift v = take n (v' <> empty n)
where
View keybase.md

Keybase proof

I hereby claim:

  • I am tfausak on github.
  • I am taylorfausak (https://keybase.io/taylorfausak) on keybase.
  • I have a public key whose fingerprint is 1074 397C 56E3 4F1B FBDA 9D31 9C45 BE88 5CC1 680A

To claim this, I am signing this object:

View binary.md
@tfausak
tfausak / stoplight.rb
Created Aug 17, 2014
Exploratory attempt at storing all stoplight runs.
View stoplight.rb
class Run
attr_reader :state
attr_reader :exception
attr_reader :time
def initialize(state, exception = nil, time = nil)
@state = state
@exception = exception
@time = time.nil? ? Time.now : time
end
@tfausak
tfausak / pfds-5-1.hs
Last active Aug 29, 2015
Exercise 5.1 from Purely Functional Data Structures
View pfds-5-1.hs
-- Purely Functional Data Structures
-- Exercise 5.1
module Main
( Deque (Deque)
, empty
, isEmpty
, cons
, head
, tail
@tfausak
tfausak / erudite.rb
Last active Aug 29, 2015
Ruby doctest
View erudite.rb
# coding: utf-8
require 'stringio'
module Erudite
class Outcome
attr_reader :result
attr_reader :output
def initialize(result, output)
You can’t perform that action at this time.