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 Main where | |
import Data.List | |
import Data.Char | |
import Test.Hspec | |
data Hand = FC | FH | TC | TP | OP | |
data Suit = S | H | D | C deriving (Read, Show) | |
data Rank = RA | R2 | R3 | R4 | R5 | R6 | R7 | R8 | R9 | RT | RJ | RQ | RK deriving (Show, Eq, Ord, Enum) | |
type Card = (Suit, Rank) |
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 Main where | |
import Data.List | |
import Data.Char | |
import qualified Data.Set as Set | |
type Gem = Int | |
gems = "abbbbcddddeefggg" | |
princess = "eagcdfbe" |
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 Test.Hspec (Spec, hspec, describe, it, shouldBe) | |
import Control.Monad (forM_) | |
samplef :: String -> String | |
samplef = concat . replicate 2 | |
main :: IO () | |
main = test | |
test :: IO () |
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
-- http://www.haskell.org/haskellwiki/99_questions/1_to_10 | |
import Test.Hspec | |
import Control.Monad | |
main = do | |
hspec $ forM_ (zip [1..] specs) $ \(n,s) -> | |
describe ("Problem " ++ show n ++ ":") s | |
specs = [myLastSpec |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
require 'RMagick' | |
include Magick | |
id_min = 0 | |
id_max = 10 | |
def annotate_id img, id | |
fname = "Octcat_%03d.png" % id | |
text = Draw.new |
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
// | |
// utils.swift | |
// md_bgmasset | |
// | |
// Created by oropon on 6/11/14. | |
// Copyright (c) 2014 oropon. All rights reserved. | |
// | |
extension Array { | |
func any(p: (T) -> Bool) -> Bool { |
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.List (group, sort) | |
import Data.Char (isNumber, isAlpha, toUpper) | |
import Test.Hspec (hspec, describe, it, shouldBe) | |
import Test.QuickCheck (Arbitrary, Gen, elements, listOf, arbitrary) | |
import Test.Hspec.QuickCheck (prop) | |
import Control.Monad (forM_) | |
import Data.Functor ((<$>)) | |
-- Main |
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
NSString*(^__block __weak r)(id,int)=^(id v,int d){NSMutableString*m,*l;m=[NSMutableString string];l=[NSMutableString string];for(id _ in [v subviews])[m appendString:r(_,d+1)];for(int i=0;i<d;i++)[l appendString:@" | "];return[NSString stringWithFormat:@"%@%@\n%@",l,[v description], m];}; | |
NSLog(@"\n%@", r(<#target_view#>, 0)); |
OlderNewer