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
#light | |
open System.Text.RegularExpressions | |
let minify js = | |
let replace (m:string) (r:string) (s:string) = Regex.Replace(s, m, r) | |
js | |
|> replace "\n\f" " " | |
|> replace "\n" " " | |
|> replace "\s{2,}" " " | |
|> replace "\{ " "{" |
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-syntax let2 | |
(syntax-rules () | |
[(_ ((var val) ...) (exp ...)) | |
((lambda (var ...) (exp ...)) val ...)])) | |
(define-syntax let2* | |
(syntax-rules () | |
[(_ ([x1 v1]) e ...) (let2 ([x1 v1]) e ...)] | |
[(_ [(x1 v1) (x2 v2)] (e ...)) |
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 pascal | |
(lambda (x) | |
(letrec ([last | |
(lambda (x) | |
(if (null? (cdr x)) x (last (cdr x))))] | |
[sum-two | |
(lambda (x) | |
(+ (car x) (cadr x)))] | |
[sum-doubles | |
(lambda (x) |
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 (+ a b) | |
(if (= a 0) | |
b | |
(inc (+ (dec a) b)))) | |
(define (+ a b) | |
(if (= a 0) | |
b | |
(+ (dec a) (inc 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
(define (p) (p)) | |
(define (test x y) | |
(if (= x 0) | |
0 | |
y)) |
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 even? | |
(lambda (x) | |
(cond ((= x 0) #t) | |
(else (odd? (- x 1)))))) | |
(define odd? | |
(lambda (x) | |
(cond ((= x 0) #f) | |
(else (even? (- x 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
Copyright (C) 2011, Eric Christensen | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
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 black-scholes | |
[letrec ( | |
[normal (lambda (zz) | |
(if (= zz 0) 0.5 | |
[let ((p 0.2316419) (b1 0.31938153) (b2 -0.356563782) (b3 1.781477937) | |
(b4 -1.821255978) (b5 1.330274428) | |
(f (/ 1 (sqrt (* 2 3.1415926)))) | |
(abszz (abs zz))) | |
[let ((ff (* f (exp (/ (- (expt abszz 2)) 2)))) | |
(s1 (/ b1 (+ 1 (* p abszz)))) |
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
#light | |
open System | |
let conc ls :string = | |
if List.length ls = 0 then "" | |
else List.reduce (fun x y -> x + y) ls | |
let av_chars = ["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "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"; "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";] | |
let special_chars = ["!"; "#"; "$"; "%"; "&"; "*"; "+"; "-"; "_"; "?"; "@";] |
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 httplib, os, urllib, base64, datetime | |
folder = <<workfolder>> | |
url = "posterous.com" | |
user = <<userid>> | |
def file_contents(filename): | |
readfile = open(folder + "\\" + filename, 'r') | |
date = readfile.readline().strip('\n') | |
content = readfile.read() |
OlderNewer