View supports.js
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 (global) { | |
var supports = Object.create(null); | |
(function __BlobUrls() { | |
// URLにベンダプレフィクスが付いているのはwebkitだけ!! | |
var URL = global.URL || global.webkitURL; | |
supports.BlobUrls = URL !== undefined && URL.createObjectURL; | |
})(); | |
(function __MessageChannel() { | |
supports.MessageChannel = !!global['MessageChannel']; | |
})(); |
View gist:3909563
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
// 参考 | |
// http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast | |
// http://stackoverflow.com/questions/10343913/how-to-create-a-web-worker-from-a-string | |
var isSupportTransferables = (function () { | |
var global = window; | |
// URLにベンダプレフィクスが付いているのはwebkitだけ!! | |
var URL = global.URL || global.webkitURL; | |
var supportsBlobUrls = URL !== undefined && URL.createObjectURL; | |
// Transferablesの方がBlobURLよりサポートが遅いし、BlobURLsを使わないと外部JSなしでworkerを作れないのでこうしている | |
if (!supportsBlobUrls) { |
View classbox.js
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 classbox = (function () { | |
var proto = Array.prototype; | |
var proto2 = Object.create(Object.getPrototypeOf(proto)); | |
Object.getOwnPropertyNames(proto).forEach(function(propName){ | |
var desc = Object.getOwnPropertyDescriptor(proto,propName); | |
Object.defineProperty(proto2,propName,desc); | |
}); | |
proto2.first = function first() { | |
return this[0]; |
View gist:3303195
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
fizzArray = []; | |
buzzArray = []; | |
new Array(101).join('a').replace(/a/g,function(n,i){ | |
fizzArray = fizzArray.concat(['','','Fizz']); | |
buzzArray = buzzArray.concat(['','','','','Buzz']); | |
var result = (fizzArray[i]+buzzArray[i]).replace(/^$/,i + 1); | |
return result + '\n'; | |
}); |
View fizzbuzz.js
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
Array.apply(null,new Array(101)) | |
.map(function(n,i){ return '';}) | |
.map(function(n,i){ return n+(i % 3 ? '' : 'Fizz');}) | |
.map(function(n,i){ return n+(i % 5 ? '' : 'Buzz');}) | |
.map(function(n,i){ return n ? n : i;}) | |
.slice(1,101) |
View canvas.html
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
<html> | |
<body> | |
<canvas id="test" width="320" height="320"></canvas> | |
<script type="text/javascript"> | |
(function() { | |
var proto = document.createElement('canvas').getContext('2d').constructor.prototype; | |
var x = proto.fillText; | |
proto.fillText = function fillText(text) { | |
if (proto.fillText !== fillText) { | |
proto.fillText = fillText; |
View gist:909813
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 stringToNSString(str) { | |
return ['@"',str,'"'].join(''); | |
} | |
function numberToNSNumber(num) { | |
return ['[NSNumber numberWithLong:',num,']'].join(''); | |
} | |
function booleanToNSNumber(bool) { | |
return ['[NSNumber numberWithBool:',(bool ? 'YES' : 'NO'),']'].join(''); | |
} |
View underscore.interval-iterator.js
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
/* | |
* Underscore.js plugin | |
* http://documentcloud.github.com/underscore/ | |
*/ | |
(function(){ | |
var root = this; | |
var console = root.console; | |
var optionsTable = {}; | |
var setResultTable = {}; | |
var lib = {}; |
View gist:765881
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(){ | |
var domManip = jQuery.fn.domManip; | |
jQuery.fn.domManip = function(){ | |
if(!jQuery.isReady && !!this.closest('body').size() ) { | |
var msg = printStackTrace().join('\n'); | |
alert(msg); | |
throw new Error(); | |
} | |
return domManip.apply(this,arguments); | |
} |
View 01_base.t
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
use JSTAPd::Suite; | |
sub tests { 11 } | |
sub include { | |
( | |
# /Users/monjudoh/Sites/callendar-demo/js/config-require.js | |
'/js/config-require.js', | |
'/js/allplugins-require.js', | |
); | |
} |
NewerOlder