Skip to content

Instantly share code, notes, and snippets.

@satyr
satyr / github_issues_canonicali.user.js
Created January 30, 2011 13:19
GitHub Issues Canonicalizer
// ==UserScript==
// @name GitHub Issues Canonicalizer
// @namespace http://about.me/satyr
// @include https://github.com/*/*/issues*
// ==/UserScript==
setTimeout(function(){
Array.forEach(document.links, function(a){
var m = /^#issue\/(\d+)$/.exec(a.hash)
if(m) a.href = /^.+\/issues\//.exec(a.pathname) + m[1]
})
@satyr
satyr / update.coffee
Created December 30, 2010 00:44 — forked from cj/update.coffee
name= if previous_keys.length > 0
then "#{main_key}[#{_.implode('][', previous_keys)}][#{key}]"
else "#{main_key}[#{key}]"
for fileName in list then do ->
fs.readFile fn = fileName, (err, contents) ->
compile fn, contents.toString()
$ bin/coffee -ne '(a,@b,c...)->d=e.f'
CodeNode "a" "@b" "c..."
Expressions
AssignNode
ValueNode "d"
ValueNode "e"
AccessorNode "f"
var CS = require('./lib/coffee-script');
var code = require('fs').readFileSync('examples/underscore.coffee').toString();
var start = Date.now();
var tokens = CS.tokens(code);
require('sys').puts(Date.now() - start +'ms ('+ tokens.length +' tokens)');
@satyr
satyr / hatena_graph_previewer.user.js
Created September 18, 2010 13:13
Hatena Graph Previewer
// ==UserScript==
// @name Hatena Graph Previewer
// @namespace http://twitter.com/m_satyr
// @include http://graph.hatena.ne.jp/*/edit*
// @license X
// ==/UserScript==
var gedit = document.getElementById('graphedit');
var table = gedit.querySelector('table');
var graph = gedit.appendChild(new Image);
var titles = document.getElementById('titlecel').children;
javascript:alert(function(){})
// SpiderMonkey / Rhino
function () {
}
// v8
function (){}
// JavaScriptCore
<script src="JSLitmus.js"></script><script>
JSLitmus.test('for(;;)', function(){
var i = 9999;
for(;;) if(!--i) break;
});
JSLitmus.test('while(true)', function(){
var i = 9999;
while(true) if(!--i) break;
});
</script>
@satyr
satyr / clone.coffee
Created August 29, 2010 11:29
prototypal coffee
# for CoffeeScript 0.9.3
@clone = (it, mixes...) ->
i = new (clone.r it)
i.__proto__ ||= it
for mix in mixes
if typeof mix is 'function'
mix.call i, it, i
else
for k, v of mix then i[k] = v
@satyr
satyr / null_vs_undefined.htm
Created August 14, 2010 21:43
null vs undefined
<script src="JSLitmus.js"></script><script>
(function(){
(function(){
(function(){
(function(){
(function(){
(function(){
(function(){
(function(){
(function(){