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
conduitTest :: Monad m => Conduit PToken (EnvT m) ByteString | |
conduitTest = do | |
a <- await | |
b <- await | |
lift . push $ PDBool True | |
yield . pack . show $ [a, b] | |
conduitPuddingEvaluator |
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
[TestMethod] | |
public void DynamicScopeTest_Object() | |
{ | |
var x = Utility.CreateDefault<DefaultTestClass>(); | |
Assert.AreEqual("hoge", x.Name); | |
using (Utility.DynamicScope(() => x.Name, "name")) | |
{ | |
Assert.AreEqual("name", x.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
[TestMethod] | |
public void DynamicScopeTest() | |
{ | |
var x = new User { Name = "hoge" }; | |
Assert.AreEqual("hoge", x.Name); | |
using (DynamicScope.Start(x, y => y.Name, "name")) | |
{ | |
Assert.AreEqual("name", x.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
masa@vardamir> clang --version | |
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn) | |
Target: x86_64-apple-darwin11.4.0 | |
Thread model: posix | |
masa@vardamir> llvm-gcc --version | |
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) | |
Copyright (C) 2007 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
function e() { | |
if [ -z `pgrep Emacs` ]; then | |
env LANG=C open -a Emacs "$@" | |
return | |
fi | |
local client="/Applications/MacPorts/Emacs.app/Contents/MacOS/bin/emacsclient" | |
local uid=`id -u` | |
local socket="$TMPDIR"/emacs"$uid"/server |
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
(defn database-from-uri [uri] | |
(let [uri (com.mongodb.MongoURI. uri)] | |
(doto (.connectDB uri) | |
(.authenticate (.getUsername uri) | |
(.getPassword uri))))) |
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
;; .. | |
;; doto | |
;; ->> | |
;; -> | |
;; の紹介 | |
;; Clojure にはカッコを減らしたり、 | |
;; オブジェクト指向ライブラリとの親和性を高めるための工夫が随所に見られる。 | |
;; そういうものの中で便利なものを4つ紹介します |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdarg.h> | |
// Lion だとこれは上書きされる | |
char* strdup(const char* arg) | |
{ | |
printf("%s\n", "my strdup"); |
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
/* | |
テーブルのヘッダが画面に残るようにする | |
$("#table").stickHeader(".header"); | |
のようにヘッダのセレクタを指定して呼び出す。 | |
*/ | |
$.fn.stickHeader = function (selector_) { | |
var selector = selector_ || ".header"; | |
var self = $(this); | |
$(window).scroll(function () { |