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
-- You can find the original in section 4.3.2 of SICP: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html#%_sec_4.3.2 | |
import Data.List | |
distinct :: Eq a => [a] -> Bool | |
distinct xs = length (nub xs) == length xs | |
require :: Bool -> [[a]] -> [[a]] | |
require b e = if b then e else return [] |
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
// by Colin Barrett (colin at springs and struts dot com) | |
// I release this sketch to the community under the MIT License. | |
// No really this is just a sketch I haven't even compiled it or anything. | |
// Other ides: | |
// - Failure & success completion selectors ? | |
// - Single delegate method called on both success and failure. | |
@interface NiceURLConnection : NSURLConnection { |
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 | |
# (c) 2009 Colin Barrett <colin@springsandstruts.com> | |
# MIT Licensed. | |
echo ' .cstring | |
format_string: | |
.asciz "Result: %d\\n" | |
.text | |
.globl _main | |
_main: |
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
% cat main.py | |
from config import config, set_config, print_config | |
print "1: %s" % (config) | |
set_config({'hello': 'world'}) | |
print "3: %s" % (config) | |
print_config() | |
% cat config.py | |
config = None |
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
#define BLOCK(...) ({ __block __typeof__(self) bself = self; __VA_ARGS__(); )} |
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
% ls -lah .dropbox ~ | |
total 89776 | |
drwxr-xr-x 11 cbarrett staff 374B May 13 11:40 . | |
drwxr-xr-x+ 56 cbarrett staff 1.9K Apr 20 18:54 .. | |
-rw-r--r-- 1 cbarrett staff 33K May 13 11:40 config.db | |
-rw-r--r-- 1 cbarrett staff 3B May 3 17:29 dropbox.pid | |
-rw------- 1 cbarrett staff 8.0M May 13 11:40 filecache.db | |
drwxr-xr-x 5 cbarrett staff 170B Feb 28 2010 finderplugin | |
-rw-r--r-- 1 cbarrett staff 73B May 3 17:30 host.db | |
-rw-r--r-- 1 cbarrett staff 24B Aug 23 2010 ignore.db |
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
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' enable hg | |
zstyle ':vcs_info:hg*' formats "%F{green}%b%f" | |
zstyle ':vcs_info:hg*' actionformats "%F{red}%a%f %F{green}%b%f" | |
zstyle ':vcs_info:hg*+set-message:*' hooks no-default-branch | |
function +vi-no-default-branch() { | |
[[ "${hook_com[branch_orig]}" != "default" ]] && return 0 | |
ret=1 |
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
tell application "Terminal" | |
open (path to desktop folder) | |
end tell |
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
import Control.Applicative | |
import Control.Monad | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C | |
import qualified Data.Map as M | |
import Text.Parsec hiding ((<|>), many) | |
import qualified Text.PrettyPrint.HughesPJ as P | |
type Parser = Parsec B.ByteString () |
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
import Control.Applicative | |
import Control.Monad | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Text.Parsec hiding ((<|>), many) | |
import Text.PrettyPrint.HughesPJ ((<>), brackets, text, braces, hsep) | |
import qualified Text.PrettyPrint.HughesPJ as P |
OlderNewer