- [Why Functional Programming Matters][whyfp]
- [Applicative Programming with Effects][app]
- [The Essence of the Iterator Pattern][iter]
- [Generalising Monads to Arrows][arrows]
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
# sans destructive update | |
def f(rss, n) | |
rss.inject(0) {|acc, rs| rs.include?(n) ? acc + 1 : acc} | |
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
+ (FKEither *)doParseContent:(NSString *)rssContent { | |
PXRss20ParserDelegate *parser = [[PXRss20ParserDelegate alloc] initWithContent:rssContent]; | |
FKEither *maybeItems = [parser.parse.right map:[NSArray liftFunction:[FKFunction functionFromSelector:@selector(parseItem:)]]]; | |
[parser release]; | |
return maybeItems; | |
} | |
+ (PXRss20Item *)parseItem:(NSDictionary *)item { | |
return [PXRss20Item title:[item objectForKey:@"item"] link:[NSURL URLWithString:[item objectForKey:@"link"]] description:[item objectForKey:@"description"]]; | |
} |
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
#!/bin/sh | |
NUM_CORES=2 | |
FJ_ARTIFACTS_DIR=/home/me/functionaljava/artifacts/latest | |
cd FJ_ARTIFACTS_DIR | |
javac -d /tmp/ -classpath functionaljava.jar demo/1.5/concurrent/Fibs.java | |
java -classpath /tmp/:functionaljava.jar concurrent.Fibs ${NUM_CORES} |
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 UserAgentHelper | |
def on_iphone_like_device? | |
request && (request.user_agent =~ /iPhone/ || request.user_agent =~ /iPod.*AppleWebKit.*Mobile.*Safari/) | |
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
// OLD | |
- (NSDictionary *)parsePerks:(NSArray *)perks { | |
NSMutableArray *convertedPerks = [NSMutableArray arrayWithCapacity:[perks count]]; | |
for (NSDictionary *perk in perks) { | |
PLPerk *convertedPerk = [[PLPerk alloc] initWithProgramName:[perk objectForKey:@"program_name"] | |
shortDescription:[perk objectForKey:@"perk_title"] longDescription:[perk objectForKey:@"perk_desc"] | |
location:[self parseLocation:[perk objectForKey:@"locations"]]]; | |
[convertedPerks addObject:convertedPerk]; | |
[convertedPerk release]; |
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
package com.foo.http | |
import scapps.http.BaseApp | |
import scapps.http.route.OptionKleisli._ | |
import scapps.http.route.Route._ | |
import scalaz._ | |
import scalaz.http.servlet.{HttpServletRequest} | |
import scalaz.http.response._ | |
import scalaz.http.request._ |
I upgraded from Snow Leopard.
Git went missing, so I downloaded the .dmg and installed it: http://code.google.com/p/git-osx-installer/downloads/detail?name=git-1.7.6-x86_64-snow-leopard.dmg&can=2&q=
Uninstalled my current devtools: sudo /Developer/Library/uninstall-devtools
Installed Xcode via the App Store.
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
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
(1..2).each { |i| puts i } |