Skip to content

Instantly share code, notes, and snippets.

@satyr
satyr / mondradelhelper.user.js
Created January 20, 2012 18:16
mondradelhelper
// ==UserScript==
// @name mondradelhelper
// @description Helps you delete redundant normal/bronze cards.
// @match http://w001.monsterdragon.jp/card/index
// @author satyr
// @version 0.2
// ==/UserScript==
var actions, header, target, action;
actions = {
Dups: function(){
<!DOCTYPE html>
<form method=POST target=result
action=http://w001.monsterdragon.jp/connect/web/login/flash/summons/do>
<input type=hidden name=summon_id value=1>
<input type=submit>
<iframe name=result style=width:99%></iframe>
@satyr
satyr / mdmu_satyr.user.js
Created December 9, 2011 08:41
mondraminiurl
/*
// ==UserScript==
// @id mdmu_satyr
// @name mondraminiurl
// @version 0.1
// @namespace http://satyr.github.com
// @author satyr
// @description Minifies the deck URL, copying it if possible.
// @include http://w001.monsterdragon.jp/deck/index*
// ==/UserScript==
{Fun, Unary} = Coco.ast
uplus = -> it instanceof Unary and it.op is \+
<- Coco.on \compile
<- it.ast.traverseChildren ..., true
# +->
if uplus it and (fun = it.it) instanceof Fun
delete it[k] for k in it
fun = it <<< {fun.__proto__, ...fun}
@satyr
satyr / gist:1080268
Created July 13, 2011 13:11 — forked from zakki/gist:1080130
FizzBuzz Scala 70B
for(n<-0 to 99)println(Seq(n+1,"Buzz","Fizz","FizzBuzz")(n%3&2|n%5/4))
@satyr
satyr / lookup_etter.co
Created July 8, 2011 14:44
__lookup?etter__ in ES5
function lookup obj, key
if obj?
obj = Object obj
do
return that if Object.getOwnPropertyDescriptor(obj, key)?[@]
while obj = Object.getPrototypeOf obj
void
<[G S]>forEach -> Object"lookup#{it}etter" = lookup.bind it.toLowerCase() + \et
  • 行末のセミコロンが不要

ASI じゃないので「不要」は語弊。

  • インデントで関数定義のブロックを表現する

「関数定義の」が余計。

@satyr
satyr / result.txt
Created June 3, 2011 04:08
WeakMap vs Array::indexOf on deduplication
uniqMap: 25ms
uniqOld: 337ms
--
on Firefox 7.01
@satyr
satyr / README.md
Created May 20, 2011 17:37 — forked from yuya-takeyama/README.md
quick sleep sort

quick sleep sort

example usage:

$ coffee quicksleepsort.coffee 3701 45 292 9 324 45 23 123 1343
9
23

45

Coco.on \compile ({ast}) -> dig ast
function dig
if it..displayName is \Block and it.lines.0?value is '"use overload"'
it.traverseChildren pick, true
return
it.eachChild dig
function pick
it <<< {compile} if it..displayName is \Op and it.second