Skip to content

Instantly share code, notes, and snippets.

@tianyicui
tianyicui / lorem.json
Created May 15, 2013 03:09
A json which will make Opalang's `Json.serialize` fail?
[{"docTitle":[],"docAuthors":[],"docDate":[]},[{"Para":[{"Str":"lorem"},"Space",{"Str":"ipsum"},"Space",{"Str":"dolor"},"Space",{"Str":"sit"},"Space",{"Str":"amet"},"Space",{"Str":"consetetur"},"Space",{"Str":"sadipscing"},"Space",{"Str":"elitr"},"Space",{"Str":"sed"},"Space",{"Str":"diam"},"Space",{"Str":"nonumy"},"LineBreak",{"Str":"eirmod"},"Space",{"Str":"tempor"},"Space",{"Str":"invidunt"},"Space",{"Str":"ut"},"Space",{"Str":"labore"},"Space",{"Str":"et"},"Space",{"Str":"dolore"},"Space",{"Str":"magna"},"Space",{"Str":"aliquyam"},"Space",{"Str":"erat"},"Space",{"Str":"sed"},"Space",{"Str":"diam"},"LineBreak",{"Str":"voluptua"},"Space",{"Str":"at"},"Space",{"Str":"vero"},"Space",{"Str":"eos"},"Space",{"Str":"et"},"Space",{"Str":"accusam"},"Space",{"Str":"et"},"Space",{"Str":"justo"},"Space",{"Str":"duo"},"Space",{"Str":"dolores"},"Space",{"Str":"et"},"Space",{"Str":"ea"},"Space",{"Str":"rebum"},"Space",{"Str":"stet"},"Space",{"Str":"clita"},"LineBreak",{"Str":"kasd"},"Space",{"Str":"gubergren"},"Space",{"
module type ORDERED =
sig
type t
val compare : t -> t -> int
end
module type HEAP =
sig
module Elem : ORDERED
type heap
module type ORDERED =
sig
type t
val compare : t -> t -> int
end
module type HEAP =
sig
module Elem : ORDERED
@tianyicui
tianyicui / y.scm
Created March 25, 2011 02:56
Deriving Y combinator in Scheme
(define fact0
(lambda (n)
(if (= n 0)
1
(* n (fact0 (- n 1))))))
(define fact1
(let
((g
(lambda (h)
#include <string.h>
void gao(char *src, char *dst, int count) {
memcpy(dst, src, count);
}
~/projects/jruby ➔ cat test.rb
#!/usr/bin/ruby
puts ARGV.inspect
~/projects/jruby ➔ ./test.rb "a" 'b' c
["a", "b", "c"]
(I hope this can help you understand.)
@tianyicui
tianyicui / gist:705043
Created November 18, 2010 14:34
nix test failed
./configure && make && make check
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-apple-darwin10.5.0
checking host system type... x86_64-apple-darwin10.5.0
checking for the canonical Nix system name... i686-darwin
checking for gcc... gcc
We couldn’t find that file to show.
@tianyicui
tianyicui / gist:704827
Created November 18, 2010 10:09
output of /usr/local/bin/ghc-pkg dump --global -v2
using cache: /Users/tianyi/.ghc/i386-darwin-6.12.3/package.conf.d/package.cache
using cache: /usr/local/Cellar/ghc/6.12.3/lib/ghc/package.conf.d/package.cache
name: Cabal
version: 1.8.0.6
id: Cabal-1.8.0.6-ec9be469687b5a514f4b7e8e2b8343c7
license: BSD3
copyright: 2003-2006, Isaac Jones
2005-2009, Duncan Coutts
maintainer: cabal-devel@haskell.org
@tianyicui
tianyicui / gist:704767
Created November 18, 2010 08:18
cabal install network-bytestring --verbose=3 failed on MacOSX10.6
$ cabal install network-bytestring --verbose=3
searching for ghc in path.
found ghc at /usr/local/bin/ghc
("/usr/local/bin/ghc",["--numeric-version"])
/usr/local/bin/ghc is version 6.12.3
looking for package tool: ghc-pkg near compiler in /usr/local/bin
found package tool in /usr/local/bin/ghc-pkg
("/usr/local/bin/ghc-pkg",["--version"])
/usr/local/bin/ghc-pkg is version 6.12.3
("/usr/local/bin/ghc",["--supported-languages"])