Skip to content

Instantly share code, notes, and snippets.

View pasberth's full-sized avatar

pasberth pasberth

View GitHub Profile
assert = require('chai').assert, (verify = require('./../src/leathershield').verify, describe('type verifier', function () {
return it('verifies a string', function () {
return result = verify({ 'type': 'String' }), (assert.property(result, 'Simple'), assert.equal(result.Simple, 'string'));
});
}))
@pasberth
pasberth / Parser.hs
Created April 19, 2014 10:24
Sintyoku
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE NamedFieldPuns #-}
module Language.LeatherScript.Parser where
@pasberth
pasberth / kansu.md
Created April 18, 2014 13:27
関数型言語の好きなところ

関数型言語の好きなところ

代数的データ型

いわゆる Haxe の enum というやつ。 これがないとプログラミングできない。

たとえば、

@pasberth
pasberth / README
Created April 17, 2014 13:17
??????????????
$ tsc a.ts
/Users/pasberth/Library/Gentoo/usr/lib/node_modules/typescript/bin/lib.d.ts(10729,11): error TS2143: Interface 'SVGComponentTransferFunctionElement' cannot extend interface 'SVGElement':
Types of property 'type' of types 'SVGComponentTransferFunctionElement' and 'SVGElement' are incompatible.
/Users/pasberth/Library/Gentoo/usr/lib/node_modules/typescript/bin/lib.d.ts(10873,11): error TS2143: Interface 'SVGFETurbulenceElement' cannot extend interface 'SVGElement':
Types of property 'type' of types 'SVGFETurbulenceElement' and 'SVGElement' are incompatible.
/Users/pasberth/Library/Gentoo/usr/lib/node_modules/typescript/bin/lib.d.ts(10905,11): error TS2143: Interface 'SVGFEColorMatrixElement' cannot extend interface 'SVGElement':
Types of property 'type' of types 'SVGFEColorMatrixElement' and 'SVGElement' are incompatible.
@pasberth
pasberth / test.hs
Created April 9, 2014 11:18
GHCJS FFI
{-# LANGUAGE JavaScriptFFI #-}
import GHCJS.Foreign
import GHCJS.Types
import Control.Applicative
foreign import javascript unsafe "document.getElementById($1).innerHTML" js_unsafeGetElementById :: JSString -> IO JSString
main = do
str <- fromJSString <$> js_unsafeGetElementById (toJSString "hoge")
@pasberth
pasberth / ghcjs-installbattle.md
Last active August 29, 2015 13:58
GHCJS Install Battle

事前に、GHC 7.8.1 が必要です

$ git clone git@github.com:ghcjs/cabal.git cabal-ghcjs
$ git clone git@github.com:ghcjs/ghcjs.git
$ cd cabal-ghcjs
$ git checkout ghcjs

# ``cabal install ./Cabal ./cabal-install'' だと cabal が上書きされてしまう。
# ``--program-suffix=-ghcjs'' をつけると cabal-ghcjs という名前でインストールされる
@pasberth
pasberth / show.ml
Created March 29, 2014 12:14
多相バリアントで Show 的な
type 'a show = [`Show of (string * 'a)]
type my_int = [`Show of (string * int)]
type my_float = [`Show of (string * float)]
type my_str = [`Show of (string * string)]
let show (`Show (pretty, x) : [< `Show of (string * 'a) ]) = pretty
let print x = print_endline (show x)
let mk_my_int x = `Show((string_of_int x), x)
WITH BOM:
757: unexpected token at '{"api_result":1,"api_result_msg":"\u6210\u529f","api_data":[{"api_id":9,"api_maparea_id":2,"api_name":"\u30bf\u30f3\u30ab\u30fc\u8b77\u885b\u4efb\u52d9","api_details":"\u6cb9\u7530\u5730\u5e2f\u304b\u3089\u71c3\u6599\u3092\u6e80\u8f09\u3057\u3066\u623b\u308b\u30bf\u30f3\u30ab\u30fc\u8239\u56e3\u3092\u8b77\u885b\u3057\u3088\u3046\uff01","api_time":240,"api_difficulty":3,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[10,1],"api_win_item2":[1,2]},{"api_id":10,"api_maparea_id":2,"api_name":"\u5f37\u884c\u5075\u5bdf\u4efb\u52d9","api_details":"\u6c34\u4e0a\u5075\u5bdf\u6a5f\u642d\u8f09\u8266\u306a\u3069\u3092\u6d3b\u7528\u3057\u3001\u6575\u8266\u968a\u306e\u52d5\u5411\u3092\u63a2\u308c\uff01","api_time":90,"api_difficulty":3,"api_use_fuel":0.3,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[1,1],"api_win_item2":[2,1]},{"api_id":11,"api_maparea_id":2,"api_name":"\u30dc\u30fc\u30ad\u30b5\u30a4\u30c8\u8f38\u9001\u4efb\u52d9","api_d

Hello!

Table of Contents

1st section

ほむほむほむほむ

2nd section

ほむほむほむほむほむほむほむほむ