This file contains hidden or 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 () { | |
| var randint = function (min, max) { | |
| if (max == null) { | |
| max = min; | |
| min = 0; | |
| } | |
| return Math.floor(Math.random() * (max - min + 1) + min); | |
| }; |
This file contains hidden or 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
| (*´ω`*) |
This file contains hidden or 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 partition = function (coll, n) { | |
| var i = 0, j; | |
| var len = Math.floor(coll.length / n); | |
| var result = [], res; | |
| for (; i < len; i++) { | |
| res = []; | |
| for (j = 0; j < n; j++) { | |
| res.push(coll[i * n + j]) |
This file contains hidden or 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
| (ns fizzbuzz-clojure) | |
| (defn- fizz? [x] | |
| (= 0 (mod x 3))) | |
| (defn- buzz? [x] | |
| (= 0 (mod x 5))) | |
| (defn- fizzbuzz? [x] | |
| (and (fizz? x) (buzz? x))) |
This file contains hidden or 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 () { | |
| var slice = [].slice; | |
| var Enum = function () { | |
| var args = slice.call(arguments); | |
| var count, len; | |
| var result = {}; | |
| for (count = 0, len = args.length; count < len; count += 1) { |
This file contains hidden or 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 fujiwara = function (str) { | |
| return str.split('').join('゛') + '゛'; | |
| }; |
This file contains hidden or 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
| String.fromCharCode('高'.charCodeAt(0) + 1); // => '髙' |
This file contains hidden or 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
| // ==UserScript== | |
| // @name mailto.js | |
| // @namespace http://st98.github.io | |
| // @description mailtoスキームのリンクをクリックした際、メーラーを起動するかどうか聞くようにするユーティリティ。 | |
| // @include * | |
| // ==/UserScript== | |
| ;(function () { | |
| [].forEach.call(document.getElementsByTagName('a'), function (element) { | |
| var address = element.getAttribute('href'); | |
| address = address.match(/mailto:(.+)/); |
This file contains hidden or 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 () { | |
| var bf = function bf(src) { | |
| if (!(this instanceof bf)) { | |
| return new bf(src); | |
| } | |
| this.src = src; | |
| }; | |
| var token = { |
This file contains hidden or 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 () { | |
| var count = function (start) { | |
| start = start || 0; | |
| return function () { | |
| return start++; | |
| }; | |
| }; | |
| var enumerate = function (iter, start) { |