View bgtest.cpp
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
#include <wx/wxprec.h> | |
#ifndef WX_PRECOMP | |
#include <wx/wx.h> | |
#endif | |
class MyApp: public wxApp | |
{ | |
public: | |
virtual bool OnInit(); |
View contains-crlf.py
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
#!/usr/bin/python | |
import sys | |
def read_content(path): | |
f = open(path, "r") | |
res = f.read() | |
f.close() | |
return res |
View minimal-wx-python.py
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 wxversion | |
wxversion.ensureMinimal('2.8') | |
import wx | |
app = wx.App(False) | |
main_frame = wx.Frame(None) | |
main_frame.Show() |
View check.py
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 re | |
import requests | |
import sys | |
import urlparse | |
TIMEOUT_IN_SECONDS = 10.0 | |
def check(base_url): | |
print("Checking %s" % base_url) | |
base_response = requests.get(base_url, timeout=TIMEOUT_IN_SECONDS) |
View MySortExample.hs
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 | |
import Test.QuickCheck | |
mySort :: [Int] -> [Int] | |
mySort list = | |
let swapped = swap list in | |
if swapped == list | |
then list | |
else mySort swapped | |
where |
View Bowling.hs
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 | |
score :: [Int] -> Int | |
score rolls = score' 10 rolls | |
where | |
score' 0 rolls = 0 | |
score' framesLeft rolls = | |
let (frameScore, restRolls) = popFrame rolls | |
in frameScore + score' (framesLeft - 1) restRolls |
View Bowling.hs
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
main = do | |
print $ score (replicate 20 0) == 0 | |
print $ score (replicate 20 1) == 20 | |
print $ score ([4,6,1,0] ++ replicate 16 0) == 10 + 1 + 1 | |
print $ score ([10,6,1] ++ replicate 16 0) == 10 + 6 + 1 + 6 + 1 | |
print $ score (replicate 18 0 ++ [3,7,1]) == 11 | |
print $ score (replicate 18 0 ++ [10,5,2]) == 10 + 5 + 2 | |
print $ score (replicate 18 0 ++ [10,10,10]) == 30 | |
print $ score (replicate 12 10) == 300 |
View gist:1395519
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 Control.Concurrent | |
import System.Console.ANSI | |
-- Logic | |
data Cell = Alive | Dead | |
deriving (Eq, Show) | |
type Neighbours = [Cell] |
View gist:857329
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
#!/usr/bin/python | |
import unittest | |
class StringCalculatorSpec(unittest.TestCase): | |
def test_returs_0_for_empty_string(self): | |
when_calculating("").the_result_is(0) | |
def test_returns_single_numbers(self): |
View calc.py
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
# Response to http://misko.hevery.com/2009/11/17/how-to-get-started-with-tdd/ | |
import unittest | |
class CalculatorTest(unittest.TestCase): | |
def setUp(self): | |
class MockView(object): |