This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = { | |
0: 10, | |
1: 9, | |
2: 8, | |
3: 7, | |
length: 4 | |
}; | |
arr.__proto__ = Array.prototype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(hello){ | |
while(!hello) { | |
try { | |
hello.world; | |
} catch (god) { | |
console.log(hello = god.message = 'Hello, world!'); | |
} | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Singleton = (function(){ | |
var Singleton = function(){} | |
, privates | |
, method | |
, name | |
, self = new Singleton(); | |
privates = { // ここはプラベートスコープにできる | |
isSingleton: true | |
, name: 'singleton' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- 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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TestEnvironment = (function(){ | |
return { | |
seed: 1, | |
count: 100, | |
current: { | |
args: [], | |
isPassed: false, | |
isSkipped: false, | |
set: function( args, prop ){ |