Skip to content

Instantly share code, notes, and snippets.

View flazz's full-sized avatar

Franco Lazzarino flazz

View GitHub Profile
@flazz
flazz / Bool.scala
Created August 16, 2013 03:14
trying to make fixed sized vectors using dependent types
package dep
sealed trait Bool {
type Cata[T <: U, F <: U, U] <: U
}
sealed trait True extends Bool {
type Cata[T <: U, F <: U, U] = T
}
class RRRWorkItem
def self.make device
new device.configuration
end
def do_it
result = @configuration.rrr
unless result
add_error("oops!")
==> Downloading http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-9.15.tar.bz2
Already downloaded: /Library/Caches/Homebrew/rxvt-unicode-9.15.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/rxvt-unicode-9.15.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file configure
Hunk #1 succeeded at 8048 (offset -207 lines).
Hunk #2 succeeded at 8085 (offset -207 lines).
patching file src/rxvtfont.C
Hunk #1 succeeded at 1265 (offset 3 lines).
==> Downloading http://dl.suckless.org/dwm/dwm-6.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/dwm-6.0.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/dwm-6.0.tar.gz
==> make PREFIX=/usr/local/Cellar/dwm/6.0 install
make PREFIX=/usr/local/Cellar/dwm/6.0 install
dwm build options:
creating config.h from config.def.h
CFLAGS = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/X11R6/include -DVERSION="6.0" -DXINERAMA
CC dwm.c
LDFLAGS = -s -L/usr/lib -lc -L/usr/X11R6/lib -lX11 -L/usr/X11R6/lib -lXinerama
@flazz
flazz / gist:3724255
Created September 14, 2012 19:44
null into vals
package example
object NullThing {
implicit def thing2option[A](x:A) = Option(x)
def main(args: Array[String]) {
val a: Option[Int] = null
val b: Option[Int] = Some(5)
class SomeClass
def initialize a, b, c
@a, @b, @c = a, b, c
end
private
def some_method x, y
@c.work_with x
@c.do_something y
end
class SomeClass
def initialize a, b, c
@a, @b, @c = a, b, c
end
def some_method
@b.work_with @a.something
@c.do_something @a.something_else
end
end
class SomeClass
def initialize a, b, c
@a, @b, @c = a, b, c
end
def some_method
do_something_with @a,
some_work_with @b
end
module Sux where
import Data.List
sux :: Ord a => [a] -> Maybe [a]
sux ns = sux' ns []
sux' :: Ord a => [a] -> [a] -> Maybe [a]
sux' pfx sfx
| canInc sfx = Just $ pfx ++ (inc sfx)
module Sux where
import Data.List
sux :: Eq a => [a] -> [[a]]
sux (a:b:[]) = [[a,b], [b,a]]
sux ns = do
x <- ns
let xs = delete x ns
xs' <- sux xs