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
import Database.TokyoCabinet.BDB | |
import qualified Database.TokyoCabinet.BDB.Cursor as C | |
main = do bdb <- new | |
setcmpfunc bdb CMPDECIMAL | |
-- setcmpfunc bdb CMPLEXICAL -- lexical order(default) | |
-- setcmpfunc bdb CMPINT32 | |
-- setcmpfunc bdb CMPINT64 | |
open bdb "foo.tcb" [OWRITER, OCREAT] | |
put bdb "1" "200" |
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
import Database.TokyoCabinet.BDB | |
import qualified Database.TokyoCabinet.BDB.Cursor as C | |
import Data.ByteString.Char8 (ByteString, unpack) | |
myCMP :: ByteString -> ByteString -> Ordering | |
myCMP k1 k2 = compare (reverse (unpack k1)) (reverse (unpack k2)) | |
main = do bdb <- new | |
setcmpfunc bdb (CMP myCMP) | |
open bdb "foo.tcb" [OWRITER, OCREAT] |
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
(defun not-found (process) | |
(process-send-string process | |
(concat "HTTP/1.1 404 Not Found\r\n" | |
"Content-Type: text/plain\r\n\r\n" | |
"Not Found")) | |
(delete-process process)) | |
(defvar boundary "-----------\n") | |
(defun httpd-filter (process string) |
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
import Data.List | |
merge :: (Ord a) => [a] -> [a] -> [a] | |
merge xs ys = merge' xs ys [] | |
where | |
merge' [] [] zs = reverse zs | |
merge' [] (y:ys) zs = merge' [] ys (y:zs) | |
merge' (x:xs) [] zs = merge' xs [] (x:zs) | |
merge' xs@(xh:xt) ys@(yh:yt) zs | |
| xh <= yh = merge' xt ys (xh:zs) |
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
use strict; | |
use warnings; | |
use Encode qw(find_encoding); | |
my $foo = 'a' x 100000; | |
for (1..10000) { | |
$foo .= 'a' x 10; | |
} |
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
tom-desktop% pwd [~] | |
/home/tom | |
tom-desktop% ghci [~] | |
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help | |
Loading package ghc-prim ... linking ... done. | |
Loading package integer ... linking ... done. | |
Loading package base ... linking ... done. | |
Prelude> :module Database.TokyoCabinet | |
Prelude Database.TokyoCabinet> runTCM $ do { db <- new :: TCM HDB; open db "foo.tch" [OWRITER, OCREAT]; put db "bar" "baz"; close db } | |
Loading package bytestring-0.9.1.4 ... linking ... done. |
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
% ghci | |
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help | |
Loading package ghc-prim ... linking ... done. | |
Loading package integer ... linking ... done. | |
Loading package base ... linking ... done. | |
Prelude> :module Database.TokyoCabinet.TDB | |
Prelude Database.TokyoCabinet.TDB> t <- new | |
Loading package bytestring-0.9.1.4 ... linking ... done. | |
Loading package HUnit-1.2.0.3 ... linking ... done. | |
Loading package filepath-1.1.0.2 ... linking ... done. |
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
var links = document.getElementsByTagName('a'); | |
for (var i=0;i<links.length;i++) { | |
if (! links[i].href.match(/\.(png|gif|png)$/) ) { | |
continue; | |
} | |
var img = document.createElement('img'); | |
img.src = links[i].href; | |
links[i].innerHTML = ''; | |
links[i].appendChild(img); | |
} |
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
function runCont(actions) { | |
$A(actions).reverse(false).inject(function(){}, function(c, f) { | |
return function () { f.apply(null, [c].concat($A(arguments))); }; | |
})(); | |
} |
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
import XMonad | |
import XMonad.Config.Gnome | |
import qualified XMonad.StackSet as W | |
import XMonad.Util.EZConfig | |
main = xmonad $ gnomeConfig | |
{ manageHook = manageHook gnomeConfig | |
, logHook = logHook gnomeConfig | |
, modMask = mod3Mask | |
} `additionalKeysP` screenKeys |
OlderNewer