Skip to content

Instantly share code, notes, and snippets.

@hmaurer
hmaurer / intput.txt
Created February 24, 2014 00:10 — forked from bemasher/intput.txt
// This is the structure of the binary nbt file
TAG_Compound('Level') {
TAG_Compound('nested compound test') {
TAG_Compound('egg') {
TAG_String('name'): 'Eggbert'
TAG_Float('value'): 0.5
}
TAG_Compound('ham') {
TAG_String('name'): 'Hampus'
TAG_Float('value'): 0.75

Useful Scalac Flags

So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings. I highly recommend a set of options something like those below.

scalacOptions ++= Seq(
  "-deprecation",           
  "-encoding", "UTF-8",       // yes, this is 2 args
  "-feature",                
 "-language:existentials",
suc (a + suc b) == suc (b + suc a)
^
|
|
suc (suc (a + b)) == suc (b + suc a)
^
|
|
suc (suc (a + b)) == suc (suc (b + a))
^
... = begin
suc (a + suc b)
==< cong suc (lemma2 a b) >
suc (suc (a + b))
==< cong (suc.suc) (comm a b) >
suc (suc (b + a))
==< cong suc (sym (lemma2 b a)) >
suc (b + suc a)
[]
module Printf
%default total
data Format = FInt Format -- %d
| FString Format -- %s
| FOther Char Format -- [a-zA-Z0-9]
| FEnd --
format : List Char -> Format

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

Installing Haskell

Ubuntu PPA

require 'tire'
require 'nobrainer'
NoBrainer.connect 'rethinkdb://server/company'
class Employee
include NoBrainer::Document
field :name
field :title
@hmaurer
hmaurer / groups.p6
Last active August 29, 2015 14:07 — forked from masak/groups.p6
role Group {
method elements { ... }
method id { ... }
method op($l, $r) { ... }
}
macro assert($fact) {
quasi {
die "FAILED: ", $fact.Str
unless {{{$fact}}};
@hmaurer
hmaurer / a3gis.purs
Last active August 29, 2015 14:13 — forked from joneshf/a3gis.purs
module A3gis where
import Data.Traversable
import Data.Map
import Data.Maybe
foo :: forall k v. (Eq v, Ord k) => Map k v -> Map k v -> Maybe (Map k v)
foo m1 m2 = sequence $ unionWith go (Just <$> m1) (Just <$> m2)
where
go x y = if x == y then x else Nothing
public function __construct(WestcottInterface $api){
//Before filters
$this->beforeFilter('check_roles', array('except' => array('getLogin','postLogin','getLogout')));
$this->beforeFilter('csrf', array('on' => 'post'));