Person/Place/Thing | Shit-storm level (tm) |
---|---|
Obama / Healthcare | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
ERB and HAML templates | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
Matt Newton Metaprogramming | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
T-Mobile | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
John | ![1][poo] |
Ruby Hash Rockets | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
Person/Place/Thing | Shit-storm level (tm) |
---|---|
Obama / Healthcare | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
ERB and HAML templates | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
Matt Newton Metaprogramming | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
T-Mobile | ![1][poo] ![2][poo] ![3][poo] ![4][poo] ![5][poo] |
John | ![1][poo] |
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
import Html as H | |
import Html ((:=)) | |
intercalate : String -> [String] -> String | |
intercalate s ss = concat (intersperse s ss) | |
shadow : Float -> Float -> Float -> Float -> Float -> Float -> String | |
shadow x y b h s l = intercalate " " [H.px x , H.px y, H.px b] ++ " " ++ H.color (hsl h s l) | |
greeting : Float -> Element |
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
;; take your make-guess function | |
(defn make-guess [guess] | |
(/ (+ (/ 2.0 guess) guess) 2.0)) | |
;; and iterate to a lazy-seq of approximations | |
(def guesses (iterate make-guess 1.0)) | |
;; then we can zip the list with itself, but shifted one value | |
;; this gives us a seq of guess pairs. | |
(def guess-pairs |
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
-- | |
-- Haskell version for comparison, just because ;) | |
-- | |
module Fizzbuzz where | |
import Control.Conditional (condDefault) | |
doFizz :: Int -> IO () | |
doFizz = sequence_ . map putStrLn . fizzbuzz | |
fizzbuzz :: Int -> [String] |
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
class UnionFind | |
def initialize(universe) | |
@data = {} | |
universe.each do |element| | |
@data[element] = element | |
end | |
end | |
def find(n) | |
root = n |
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
module FizzBuzz | |
class Runner | |
attr_writer :handlers | |
def initialize(output) | |
@output = output | |
end | |
def run(n) | |
n.times { |n| round(n+1) } |
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
type Prop = String | |
type Value = String | |
newtype ChartConf = Conf { toList :: [(Prop, Value)] } deriving Show | |
newtype Charter a = Charter { runCharter :: a -> ChartConf } | |
instance Monoid ChartConf where | |
mempty = Conf [] | |
c1 `mappend` c2 = Conf $ toList c1 `mappend` toList c2 |
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
import Data.Thyme hiding (seconds) | |
import Data.Thyme.Format.Human | |
import Data.AffineSpace | |
import Data.VectorSpace | |
seconds, minutes, hours, days, weeks :: Rational -> NominalDiffTime | |
seconds n = fromSeconds n | |
minutes n = n *^ 60 *^ seconds 1 | |
hours n = n *^ 60 *^ minutes 1 | |
days n = n *^ 24 *^ hours 1 |
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
class Post | |
# Make the DI overhead a bit more bareable with a factory method. You can | |
# still use the default constructor if you need the extra flexibility. | |
# | |
# I'm not quite sure about this last parameter though for the should_order. | |
# Most of the time passing a boolean is a code smell that you have some unwanted | |
# control coupling... | |
# | |
def self.standard_post(should_order) | |
alarm_handler = AlarmHandler.new(:post_search) |
NewerOlder