Free in Haskell:
data Free f a = Return a
| Suspend (f (Free f a))
Free in a strict language:
. 5 . | . . 1 | 4 7 9 | |
. . 2 | 7 . . | . . 8 | |
. . . | . 4 6 | 2 . . | |
------+-------+------ | |
. 4 6 | . . 9 | 5 3 7 | |
. . . | . 6 . | . . . | |
8 9 3 | 5 . . | 6 4 . | |
------+-------+------ | |
. . 9 | 6 1 . | . . . | |
1 . . | . . 2 | 3 . . |
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} |
toshok@ubuntu:~/src/echo-js/test$ cat hello-world.js | |
console.log("hello world!"); | |
toshok@ubuntu:~/src/echo-js/test$ ../ejs --target linux_amd64 hello-world.js | |
COMPILE hello-world.js | |
LINK hello-world.js.exe | |
done. | |
toshok@ubuntu:~/src/echo-js/test$ file hello-world.js.exe | |
hello-world.js.exe: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=c1d04704e87bbc85a398160e9125c2864b2da659, not stripped | |
toshok@ubuntu:~/src/echo-js/test$ ./hello-world.js.exe | |
hello world! |
Free in Haskell:
data Free f a = Return a
| Suspend (f (Free f a))
Free in a strict language:
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
# | |
# Current known FCC address ranges: | |
# https://news.ycombinator.com/item?id=7716915 | |
# | |
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
# | |
# In your nginx.conf: | |
location / { |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import subprocess | |
__all__ = ["transform"] | |
__version__ = '0.3' | |
__author__ = 'Christoph Burgmer <[email protected]>' | |
__url__ = 'http://github.com/cburgmer/upsidedown' |
//! Leveraging tuples to make a statically typed, concatenative EDSL in Rust. | |
//! | |
//! I'm not sure how practical it really is – Rust's syntax can make it a little | |
//! hard to read, but it's fun to play around with it. The neat thing is how | |
//! little copying occurs. Everything is moved in and out by-value in a pipeline. | |
//! | |
//! Thanks goes to [Tekmo on reddit](http://www.reddit.com/r/programming/ | |
//! comments/1zzom4/using_functionlength_to_implement_a_stack_language/cfyibsr) | |
//! for the idea. | |
//! |
var crypto = require("crypto") | |
var User = function(attributes) { | |
this._attributes = attributes || {} | |
} | |
User.KEY_LENGTH = 32 | |
User.WORK_FACTOR = 20000 | |
User.prototype.setPassword = function(password, callback) { |
angular | |
.module('app') | |
.config(function ($httpProvider) { | |
$httpProvider.interceptors.push(['$injector', '$q', function ($injector, $q) { | |
return { | |
responseError: function (rejection) { | |
var $http = $injector.get('$http'), | |
$state = $injector.get('$state'), | |
MAX_RETRY_ATTEMPTS = 2, | |
request = rejection.config, |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"