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
{ | |
packageOverrides = pkgs: | |
let | |
haskell = pkgs.haskellPackages_ghc704; | |
hiPrio = pkgs.lib.hiPrio; | |
in | |
rec { | |
mathijs = pkgs.buildEnv { | |
name = "mathijs"; |
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 Chapter11 where | |
import Data.List (find, transpose) | |
data Maze = Maze String [Maze] | |
unsafeFind :: (a -> Bool) -> [a] -> a | |
unsafeFind p xs = let Just x = find p xs | |
in x |
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
add_x_forwarded_proto = Filter(name="/usr/lib/mongrel2/filters/headers.so", settings={ | |
"operation": "set", # set / unset / setIfNull | |
"name": "x-forwarded-proto", | |
"value": "https" # it might be nice to have this available as variable "$proto" | |
}) | |
main = Server( | |
... | |
filters = [add_x_forwarded_proto] | |
) |
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
Db.prototype.checkoutRawConnection = function() { | |
var conn = this.serverConfig.checkoutWriter(); | |
return conn.pool[conn.poolIndex++ % conn.pool.length]; | |
}; | |
Db.prototype.lastErrorOnConnection(connection, options, callback) { | |
if ('function' === typeof options) callback = options, options = {}; | |
var command = DbCommand.createGetLastErrorCommand(options, 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
diff --git a/examples/wschat/chat.py b/examples/wschat/chat.py | |
index 4054942..be0b9ab 100644 | |
--- a/examples/wschat/chat.py | |
+++ b/examples/wschat/chat.py | |
@@ -110,7 +110,8 @@ while True: | |
continue | |
if data["type"] == "join": | |
- conn.deliver_json(req.sender, users.keys(), data) | |
+ if len(users.keys()) > 0: |
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
diff -urN http-proxy/lib/node-http-proxy.js http-proxy-fixes/lib/node-http-proxy.js | |
--- http-proxy/lib/node-http-proxy.js 2011-05-16 18:23:58.746129001 +0200 | |
+++ http-proxy-fixes/lib/node-http-proxy.js 2011-05-16 18:37:53.876129001 +0200 | |
@@ -585,10 +585,6 @@ | |
var agent = _getAgent(options.host, options.port), | |
remoteHost = options.host + (options.port - 80 === 0 ? '' : ':' + options.port); | |
- // Change headers | |
- req.headers.host = remoteHost; | |
- req.headers.origin = 'http://' + options.host; |
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 Main where | |
import Control.Distributed.STM.DSTM | |
import System.Environment (getArgs) | |
main = startDist goTasks | |
goTasks = do | |
(arg:_) <- getArgs | |
let n = read arg |
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 Main where | |
import Control.Distributed.STM.DSTM | |
import System.Environment (getArgs) | |
main = startDist goTasks | |
goTasks = do | |
(arg:_) ← getArgs | |
let n = read arg |
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
{-# LANGUAGE OverloadedStrings #-} | |
import Database.MongoDB | |
import Data.UString (u) | |
import Control.Monad.Trans (liftIO) | |
main = do | |
ee <- runNet $ do | |
conn <- connect (host "127.0.0.1") | |
runConn run conn |
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 Main where | |
partEither list = helper list ([],[]) | |
where | |
helper [] (l,r) = (reverse l,reverse r) | |
helper ((Left a):xs) (l,r) = helper xs (a:l,r) | |
helper ((Right b):xs) (l,r) = helper xs (l,b:r) | |
test = iterate (\(Left x) -> Left (x+1)) (Left 0) |