This file contains hidden or 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(website_worker). | |
-export([behaviour_info/1, get/2]). | |
behaviour_info(callbacks) -> | |
[{process, 1}]; | |
behaviour_info(_) -> undefined. | |
get(Module, Site) -> Module:process(get_site(Site)). |
This file contains hidden or 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
mapList foo (h:hs) = foo(h):mapList foo hs | |
mapList foo [] = [] | |
-- last pattern is empty list | |
-- no imports / exports needed | |
-- single var assignment | |
-- type sefe ? type inference | |
data BookInfo = Book Int String [String] | |
deriving (Show) |
This file contains hidden or 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
let capCount = length . filter (isUpper . head) . words | |
-- "." is compose , compose f g x = compose f (g x) | |
-- "." works like this f . g -> f (g ) | |
-- creates composition of functions, new function | |
-- above sample explained | |
c1 = compose isUpper head | |
c2 = compose filter(c1) words |
This file contains hidden or 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
/* www.foldr.com */ | |
for(;true;){f(document.getElementsByTagName("a")[0])} | |
/* ;], Problem ? Firefox */ |
This file contains hidden or 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
(putStrLn . show) "11" | |
-- 11 | |
-- . for compose, compose f g x = f (g x) | |
-- with curry we receive a thunk ( lamba ? ) from ( putStrLn . show ) and we pass argument of "11" so we -- get same as: putStrLn (show "11"). show is defined in type class "show" | |
-- its brain damaging :/ but looks pro. |
This file contains hidden or 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 Filter | |
FILTERS = { | |
:not_cancelled => lambda {|booking| booking.cancelled == false }, | |
# ... | |
} | |
def filter(rows, *filters) | |
booking = Booking.get_in_class(row['booking_reference']) | |
is_ok = true |
This file contains hidden or 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
describe "Affiliate Window Integration" do | |
it "should store in cookies affiliate window code" do | |
controller.should_receive(:affiliate_window_code_handler) | |
get :new, "awc" => "this-is-test-code" | |
cookies["awc"].should_not be_nil | |
cookies["awc"].should eql("this-is-test-code") | |
response.should be_success | |
end | |
end |
This file contains hidden or 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
valgrind | |
segmentation fault |
This file contains hidden or 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
tell application "System Preferences" | |
set current pane to pane "com.apple.preference.keyboard" | |
end tell | |
tell application "System Events" | |
-- If we don't have UI Elements enabled, then nothing is really going to work. | |
if UI elements enabled then | |
tell application process "System Preferences" | |
get properties | |
This file contains hidden or 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
/* Adding index */ | |
db.places.ensureIndex( { loc : "2d" } ) |