Skip to content

Instantly share code, notes, and snippets.

View igstan's full-sized avatar

Ionuț G. Stan igstan

View GitHub Profile
[?] (letrec length = (\l ⇒ ((cond (isNull l)) 0) (succ (length (tail l)))) in length)
| [+] t0
| [?] (\l ⇒ ((cond (isNull l)) 0) (succ (length (tail l))))
| | [+] t1
| | [?] (((cond (isNull l)) 0) (succ (length (tail l))))
| | | [+] t2
| | | [?] ((cond (isNull l)) 0)
| | | | [+] t3
| | | | [?] (cond (isNull l))
| | | | | [+] t4

Here's a struct in C:

struct Point
{
  int x;
  int y;
} ;

Given a variable p0 which is typed as struct Point:

# PHPUnit recipe for kicker
require 'osx/cocoa'
recipe :phpunit do
process do |files|
execute "phpunit"
end
end
# take control of the growl notifications
{-# LANGUAGE DoRec #-}
module ExprLang where
import Control.Monad.Error
import Data.List
import Data.Maybe
-- Language
@wrwills
wrwills / smtp.hs
Created October 18, 2010 13:31
mime-mail + HaskellNet
import Network.Mail.Mime
import qualified Data.ByteString.Lazy.UTF8 as LU
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString as S
import Control.Monad
import qualified HaskellNet.SMTP as HN
import Text.Pandoc
import Text.Hamlet
import Text.XHtml.Transitional hiding ( renderHtml )
(define (make-simple-generator iterable transformer)
(define (re-entry return)
(define (iter-action element)
(define (escaper new-re-entry)
(set! re-entry new-re-entry)
(return ( transformer element)))
(call-with-current-continuation escaper))
(for-each iter-action iterable)
(return 'Let-it-end!))
@DmitrySoshnikov
DmitrySoshnikov / harmony-iterator.js
Created March 11, 2011 08:38
harmony-iterators.js
//
// by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
// MIT Style License
// see also: http://wiki.ecmascript.org/doku.php?id=strawman:iterators
//
// ---------------------------------------
// 1. Iteration via for-in loop
// ---------------------------------------
@mattetti
mattetti / fsevents.rb
Created March 18, 2011 07:19
FSEvents API implementation in MacRuby
if RUBY_ENGINE == 'macruby'
framework 'CoreServices'
WATCHED_EXTS = "rb,builder,erb,nokogiri"
PASSENGER_RESTART_FILE = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp", "restart.txt"))
DELAY = 3
def modified_files(path)
Dir.glob("#{File.expand_path(path)}/*.{#{WATCHED_EXTS}}").map do |filename|
begin
@avernet
avernet / list-general.coffee
Created May 3, 2011 02:48 — forked from igstan/state-monad.coffee
State Monad in CoffeeScript
#### Monad - common code
# bind takes a step and processor,
# and combines them into a step
# (S t) -> (t -> S u) -> (S u)
bind = (step, processor) -> (container) ->
result = step container
(processor result.value) result.container
anonymous
anonymous / bootstrap.sh
Created June 2, 2011 17:19
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF