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 php.Lib; | |
import php.Web; | |
enum Option<T> { | |
None; | |
Some( item: T ); | |
} | |
class Index { |
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
#!/bin/bash | |
# wait for any modification events, then do an action when they come up | |
inotifywait -mqre close_write -e delete --format "%:e %w %f" ./ | while read -r event path newfile | |
do | |
# don't upload temporary files | |
if [[ $newfile =~ .*~|\.swp.* ]]; then | |
continue | |
fi |
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
for x in $(sudo docker images | grep none | awk '{print $3}'); do sudo docker rmi $x; done | |
sudo docker ps -a | awk '{print $1}' | xargs sudo docker rm |
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
-- test.hs --------------------------------------- | |
module Main where | |
data Foo = F1 | F2 | F3 deriving (Show, Eq) | |
foo :: Foo -> Foo | |
foo x = case x of | |
F1 -> F2 | |
F2 -> F3 | |
F3 -> F1 |
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
:syntax on | |
"Syntax Support | |
au BufRead,BufNewFile *.md set syntax=tex | |
:autocmd FileType * set formatoptions=tcql nocindent comments& | |
:autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,ex:*/,:// | |
au FileType htm,html,xhtml,xml so ~/.vim/ftplugin/html_autoclosetag.vim | |
au BufRead,BufNewFile *.fs,*.fsx set filetype=fs | |
au BufRead,BufNewFile *.fs,*.fsx set syntax=ocaml | |
au! BufRead,BufNewFile *.gsl setfiletype gsl |
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
#lang typed/racket | |
;; We get exhaustive pattern matching | |
(: f ((U String Integer) -> Boolean)) | |
(define (f x) | |
(cond | |
[(string? x) (string=? x "hi")] ; covers string needs | |
[(exact-nonnegative-integer? x) (= x 7)] ; covers positive integers | |
[(even? x) (= x -8)] ; we can actually cover a subset of negative integers |
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
<?php | |
class Matcher { | |
private $cases = array(); | |
function __construct($target, $source) { | |
$this->target = $target; | |
$this->source = $source; | |
} |
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 zlib, os, sys | |
def getsize(s): | |
return len(zlib.compress(s)) | |
def dist(a, b): | |
n1 = getsize(a); n2=getsize(b) | |
return (min(getsize(a+b), getsize(b+a)) - min(n1,n2))/float(max(n1,n2)) |
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 inner (k n) | |
(cond | |
((> (* k k) n) 1) | |
((= 0 (mod n k)) 0) | |
(t (inner (+ k 2) n)))) | |
(defun is_prime (n) | |
(cond | |
((= n 2) 1) | |
((< n 2) 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
good_enough(f, guess) := | |
if (cabs(f(guess))<1E-15) then true | |
else false$ | |
improve(f, guess) := | |
guess - (f(guess)/(at (diff (f(z), z, 1), [z = guess])))$ | |
newton(f,guess) := | |
if (good_enough(f,guess)=true) | |
then guess |