Skip to content

Instantly share code, notes, and snippets.

View ryoakg's full-sized avatar

℟γồ ᾅḳᐃϼ╿ ryoakg

View GitHub Profile
@ryoakg
ryoakg / securimage-catpcha.php
Last active January 19, 2017 04:45 — forked from fddcddhdd/gist:6774618
PHPでCAPTCHA実装
<?php
if (PHP_SAPI === 'cli') {
echo 'Usage:' . PHP_EOL;
echo ' Download Securimage archive from http://www.phpcaptcha.org/download/ and decompress.' . PHP_EOL;
echo ' run: php -S localhost:8080' . PHP_EOL;
echo " browse: http://localhost:8080/{$argv[0]}" . PHP_EOL;
exit;
}
session_start();
@ryoakg
ryoakg / apply_ctor.clj
Last active June 29, 2016 15:12 — forked from athos/apply_ctor.clj
引数は同じで、コンストラクタを可変にしたい場合
(ns apply-ctor
(import [java.lang.reflect Constructor]))
(defn- acceptable-types? [ptypes atypes]
(and (= (count ptypes) (count atypes))
(every? (fn [[ptype atype]]
(or (= ptype atype)
((ancestors atype) ptype)))
(map vector ptypes atypes))))
@ryoakg
ryoakg / mutable-deftype.clj
Created April 10, 2016 01:19 — forked from shinmuro/mutable-deftype.clj
Clojure deftype that has mutable field and setter method sample.
(defprotocol IEditName
(get-name [this])
(set-name! [this val]))
(deftype PersonName [^:volatile-mutable lname]
IEditName
(get-name [this] (. this lname))
(set-name! [this val] (set! lname val)))
(def pname (PersonName. "hoge"))
@ryoakg
ryoakg / pipeline.clj
Last active March 5, 2016 08:11 — forked from JacobNinja/pipeline.clj
Clojure core.async pipeline example
(ns foo
(:require [clojure.core.async :as async]
[clj-http.client :as http]))
(comment
:dependencies
[[org.clojure/core.async "0.2.374"]
[cheshire "5.5.0"]
[clj-http "2.1.0"]
])
@ryoakg
ryoakg / 0_reuse_code.js
Created October 16, 2015 13:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console