Skip to content

Instantly share code, notes, and snippets.

View VoQn's full-sized avatar
:shipit:
I may be slow to respond.

Kazuhiro Mizushima VoQn

:shipit:
I may be slow to respond.
View GitHub Profile
@VoQn
VoQn / gist:3157701
Created July 22, 2012 00:26
nicobook.css
@@ -111, +111,113 @@
- min-width: 6em;
+ min-width: 6ex;
+ font-size: 16pt;
+ font-weight: bold;
@@ -265, +267 @@
- font-size: 1.5em;
+ font-size: 21pt;
@VoQn
VoQn / example_test.coffee
Created July 12, 2012 15:54
macchiato.js-v0.2.0 feature
people = require "../lib/people"
test_data =
Tom:
age: 15
gender: people.GENDER.MALE
Beth:
age: 15
gender: people.GENDER.FEMALE
@VoQn
VoQn / prototyping.js
Created July 3, 2012 16:12
はいそうですね
var arr = {
0: 10,
1: 9,
2: 8,
3: 7,
length: 4
};
arr.__proto__ = Array.prototype;
@VoQn
VoQn / try_catch.js
Created July 3, 2012 11:49
ジョークです
;(function(hello){
while(!hello) {
try {
hello.world;
} catch (god) {
console.log(hello = god.message = 'Hello, world!');
}
}
})();
@VoQn
VoQn / gist:2960607
Created June 20, 2012 15:52
test Object.create
var clone = function( object ) {
var copied = Object.create( Object.getPrototypeOf( object ) ),
properties = Object.getOwnPropertyNames( object ),
index = 0,
name;
for ( ; name = properties[ index ]; index++ ){
Object.defineProperty( copied,
name,
Object.getOwnPropertyDescriptor( object, name ) );
}
@VoQn
VoQn / singleton.js
Created May 23, 2012 12:25
Singleton
var Singleton = (function(){
var Singleton = function(){}
, privates
, method
, name
, self = new Singleton();
privates = { // ここはプラベートスコープにできる
isSingleton: true
, name: 'singleton'
@VoQn
VoQn / ExactNum.hs
Created March 29, 2012 15:35
すごい乱暴な方法で小数を割かし正確な有理数にする
--
-- Problem
-- > toRational 1.1 -- 2476979795053773 % 2251799813685248 I want `11 % 10`
-- > fromRational $ toRational 1.1 -- 1.1
-- > (toRational 1.1) == (11 % 10) -- False
--
import Numeric ( floatToDigit, fromRat )
import Data.Ratio ( (%), denominator )
-- | exact ratio number from Real `a`
Sat Mar 10 14:38 2012 Time and Allocation Profiling Report (Final)
basicFib +RTS -p -RTS
total time = 1.82 secs (91 ticks @ 20 ms)
total alloc = 7,947,854,776 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
CAF Main 100.0 100.0
@VoQn
VoQn / OutPuts
Created March 9, 2012 07:21
My Test Utility Module
RGB data: #ff0033:
it should get RED value : [OK]
it should get GREEN value: [OK]
it should get BLUE value : [OK]
\rgb -> red rgb:
λ (RGB 256 0 51) -> 256 : [OK]
λ (RGB 85 0 68) -> 85 : [OK]
Properties Test Cases Total
Passed 0 5 5
@VoQn
VoQn / gist:1962459
Created March 2, 2012 23:44
My .ctags file
--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/o,object/
--regex-js=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/f,function/
--regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*([^)])/\1/f,function/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/a,array/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^"]'[^']*/\1/s,string/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^']"[^"]*/\1/s,string/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[\-]*[0-9]+/\1/n,number/
--regex-js=/([^= ]+)[ \t]*=[ \t]*(true|false)/\1/b,boolean/