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
<?php | |
/* | |
* This is a simple example of using PHP's OAuth extension to fetch a valid | |
* token for a given member. The process is a typical OAuth 1.0a flow, which | |
* includes requesting a member's authorization to act on her behalf and then | |
* fetching the actual token once authorized. This token can then be stored | |
* and used to make API calls on the member's behalf. For an example of making | |
* such a call once you have retriefed an authorized token, see: | |
* |
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
<?php | |
/* | |
* This is a simple example of using PHP's OAuth extension to send a message | |
* to another member. It assumes you have already recieved the necessary | |
* authorization from the user and stored the token for reuse. | |
* See https://gist.github.com/chrislewis/7a1286924a93b369de86 for an | |
* example of how to fetch a valid token for a given member, with her | |
* authorization, using your consumer key and secret. | |
* |
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
/* | |
CanBuildFrom is easily abused such that the ubiquitous higher order function | |
map can be repurposed as fold. This is not good; this example demonstrates | |
a design flaw, not a strength. | |
*/ | |
import scala.language.postfixOps | |
import scala.collection.generic |
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
sealed trait Foo | |
case class Bar(x: Int) extends Foo | |
case class Baz(name: String) extends Foo | |
object Foo { | |
def show(f: Foo) = | |
f match { | |
case Bar(x) => x.toString // Quux, a subtype of Bar in a different file, will be matched as a Bar | |
case Baz(name) => name | |
} |
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
class Lambda255 { | |
interface F255<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,EE,FF,GG,HH,II,JJ,KK,LL,MM,NN,OO,PP,QQ,RR,SS,TT,UU,VV,WW,XX,YY,ZZ,AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III,JJJ,KKK,LLL,MMM,NNN,OOO,PPP,QQQ,RRR,SSS,TTT,UUU,VVV,WWW,XXX,YYY,ZZZ,AAAA,BBBB,CCCC,DDDD,EEEE,FFFF,GGGG,HHHH,IIII,JJJJ,KKKK,LLLL,MMMM,NNNN,OOOO,PPPP,QQQQ,RRRR,SSSS,TTTT,UUUU,VVVV,WWWW,XXXX,YYYY,ZZZZ,AAAAA,BBBBB,CCCCC,DDDDD,EEEEE,FFFFF,GGGGG,HHHHH,IIIII,JJJJJ,KKKKK,LLLLL,MMMMM,NNNNN,OOOOO,PPPPP,QQQQQ,RRRRR,SSSSS,TTTTT,UUUUU,VVVVV,WWWWW,XXXXX,YYYYY,ZZZZZ,AAAAAA,BBBBBB,CCCCCC,DDDDDD,EEEEEE,FFFFFF,GGGGGG,HHHHHH,IIIIII,JJJJJJ,KKKKKK,LLLLLL,MMMMMM,NNNNNN,OOOOOO,PPPPPP,QQQQQQ,RRRRRR,SSSSSS,TTTTTT,UUUUUU,VVVVVV,WWWWWW,XXXXXX,YYYYYY,ZZZZZZ,AAAAAAA,BBBBBBB,CCCCCCC,DDDDDDD,EEEEEEE,FFFFFFF,GGGGGGG,HHHHHHH,IIIIIII,JJJJJJJ,KKKKKKK,LLLLLLL,MMMMMMM,NNNNNNN,OOOOOOO,PPPPPPP,QQQQQQQ,RRRRRRR,SSSSSSS,TTTTTTT,UUUUUUU,VVVVVVV,WWWWWWW,XXXXXXX,YYYYYYY,ZZZZZZZ,AAAAAAAA,BBBBBBBB,CCCCCCCC,DDDDDDDD,EEEEEEEE,FFFFFFFF,GGGGGGGG,HHHHHHHH,IIIIIII |
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
/* | |
* This is a rendition of https://gist.github.com/3416494. Scalaz7 provides the | |
* Reader and we take it a step further by constructing and using a Reader Either | |
* monad transformer with pure error handling, instead of the original impure Reader | |
* monad that would throw exceptions on parse errors. | |
*/ | |
import scalaz._ | |
import Scalaz._ | |
import java.util.Properties |
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/perl | |
use JSON; | |
use IO::Socket; | |
my $pid=$$; | |
my $user = "marketmaker"; | |
my $pass = "liquidity"; | |
my $host = "10.10.9.115"; | |
my $port = "10000"; |
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
/* Start by creating a reader for some fake yet conceivable type for executing SQL queries. */ | |
val dbReader: Reader[Properties, JdbcExecutor] = | |
for { | |
driver <- read[String]("db.driver") | |
uri <- read[String]("db.uri") | |
user <- read[String]("db.username") | |
password <- read[String]("db.password") | |
name <- read[String]("db.pool.name") | |
minCons <- read[Int]("db.pool.minConnections") |
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
package com.example.foobie | |
import unfiltered.jetty.Http | |
import unfiltered.response._ | |
import unfiltered.request._ | |
trait Resolver[A] { | |
type B | |
} |
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
trait Bind[M[_]] { | |
def fmap[A, B](ma: M[A], f: A => B): M[B] | |
def bind[A, B](ma: M[A], f: A => M[B]): M[B] | |
} | |
trait Monad[M[_]] extends Bind[M]{ | |
def unit[A](a: => A): M[A] |