Skip to content

Instantly share code, notes, and snippets.

import std.traits;
struct Signed {}
struct Unsigned {}
struct Wrapper(V, T) {
private V value;
private T tag;
alias value this;
// dmd 2.063
// ref. http://d.hatena.ne.jp/yutakikuchi/20130617/1371425713
import std.array, std.conv, std.datetime;
import std.stdio;
void main() {
// 現在時刻のDateTimeを取得
{
const current = Clock.currTime;
;; gauche 0.9.3.3
;; ref. http://developer.hatenastaff.com/entry/2013/04/11/143235
(use rfc.json)
(use rfc.http)
(use rfc.uri)
(define (api-request uri)
(receive (scheme user-info hostname port path query fragment) (uri-parse uri)
(receive (status header body) (http-get hostname path)
@psihy
psihy / gist:5003421
Last active December 14, 2015 01:08
httpstatus
import std.algorithm, std.array, std.stdio, std.typecons;
immutable statusCode = [
tuple("100", "Continue"),
tuple("101", "Switching Protocols"),
tuple("102", "Processing"),
tuple("200", "OK"),
tuple("201", "Created"),
tuple("202", "Accepted"),
tuple("203", "Non-Authoritative Information"),
@psihy
psihy / gist:4225738
Created December 6, 2012 16:21
enchant.js sample in BiwaScheme.
<!-- BiwaScheme 0.6.1 -->
<html>
<head>
<title>enchant.js sample in BiwaScheme</title>
</head>
<body>
<div id="enchant-stage" />
@psihy
psihy / gist:4225578
Created December 6, 2012 16:00
FFI in BiwaScheme.
;; JavaScript の関数を呼び出す
;; e.g. rosso(fantasma)
(js-call (js-eval "rosso") fantasma)
;; クラスのインスタンスを生成する
;; e.g. new Tiro(finale)
(js-new "Tiro" finale)
;; クラスのメソッドを呼び出す
;; e.g. homu.attack(baretter, eagle, remington, m249)
@psihy
psihy / gist:3180908
Created July 26, 2012 08:11
Get random words using Wikipedia API and BiwaScheme
<!-- BiwaScheme 0.6.1 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Powered by BiwaScheme</title>
<style>
input#fire { width: 50px; height: 24px; font-size: 14px; }
</style>
</head>
@psihy
psihy / gist:2206070
Created March 26, 2012 15:43
いかにしておっぱい画像をダウンロードするか~2012 Scheme(Gauche)編
; Gauche 0.9.2
(use srfi-43)
(use rfc.http)
(use rfc.json)
(use rfc.uri)
(use util.list)
(use util.match)
(use file.util)
(use gauche.threads)