Skip to content

Instantly share code, notes, and snippets.

-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)).
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)
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
/* www.foldr.com */
for(;true;){f(document.getElementsByTagName("a")[0])}
/* ;], Problem ? Firefox */
(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.
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
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
valgrind
segmentation fault
@JakubOboza
JakubOboza / Toggle Function Keys.scpt
Created July 5, 2011 14:49 — forked from ysamlan/Toggle Function Keys.scpt
Toggle function keys / media keys on OS X 10.6 & show current status with Growl (updated from http://macsteps.com/blog/tips/how-to-quickly-toggle-your-keyboards-function-keys/ which only works on 10.5)
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
@JakubOboza
JakubOboza / index.js
Created July 7, 2011 21:39
Mongodb Geospital Index
/* Adding index */
db.places.ensureIndex( { loc : "2d" } )