Skip to content

Instantly share code, notes, and snippets.

View phadej's full-sized avatar
🦉
Someone here is possessed by an owl. Who?

Oleg Grenrus phadej

🦉
Someone here is possessed by an owl. Who?
View GitHub Profile
@phadej
phadej / test.sh
Last active December 25, 2015 04:38
#!/bin/sh
python -m SimpleHTTPServer &
SERVER_PID=$!
sleep 1
echo started server
curl 127.0.0.1:8000
kill $SERVER_PID

and btw, you cannot really program literate as Knuth meant it in javascript. The problem is that you cannot rearrange your code blocks freely:

Module foobar

exports

module.exports = {
  CONST: CONST, // = "ant"
 foo: foo,
$ = require "./doc.coffee"
doc = new $.Doc
doc.section "Bacon.js"
doc.logo()
doc.text """
A small functional reactive programming lib for JavaScript.
Turns your event spaghetti into clean and declarative feng shui bacon, by switching
"use strict";
var _ = require("lodash");
var Bacon = require("baconjs");
function Scheduler() {
this.time = 0;
this.events = [];
}
@phadej
phadej / SysF.idr
Last active January 3, 2016 14:09
The only thing you need is a lambda abstraction.
module SysF
%default total
-- type definition
bool : Type
bool = (x : Type) -> x -> x -> x
true : bool
true t a b = a
@phadej
phadej / p.agda
Last active January 3, 2016 22:08
Universe polymorphism.
module p where
open import Agda.Primitive
ℕ : (ℓ : _) → Set (lsuc ℓ)
ℕ ℓ = {x : Set ℓ} → (z : x) → (s : x → x) → x
zero : ∀ {ℓ} → ℕ ℓ
zero = λ z s → z
type ID = forall x. x -> x
id' :: ID
id' x = x
id'' :: ID
id'' = id' id'
type List a = forall b . (a -> b -> b) -> b -> b
nil :: forall a. List a
nil _ = id
cons :: forall a. a -> List a -> List a
cons h t f = f h . t f
listmap :: forall a b. (a -> b) -> List a -> List b
listmap f l = l defineme nil