Skip to content

Instantly share code, notes, and snippets.

@su10
su10 / promise_snipet
Created November 2, 2014 09:46
promise-as3のPromise#when実装
public function when( ...args ):Promise {
if( args.length == 1 && args[0] is Array ) {
args = args[0];
}
// 引数が0個ならreject
if( args.length == 0 ) {
return this.then(
function( value:* ):void {
Deferred.reject('arguments must not be empty.');
def hash_for_includes_all_masters(recursive=true, all_associations=[])
all_associations << self.to_s
result_arr = []
self.reflect_on_all_associations.each do |model|
association_name = model.name
class_name = model.class_name
next if all_associations.include?(class_name)
next unless class_name.include?('Master')
next if model.options.has_key?(:polymorphic)
@su10
su10 / Canvasタグで作るお絵かきツール
Created May 20, 2012 03:30
自作のGreasemonkeyスクリプト
// ==UserScript==
// @name Canvasタグで作るお絵かきツール
// @namespace su10
// @description せつめいぶんだよ
// @include http://*
// @version 1.0.0
// ==/UserScript==
var body = document.getElementsByTagName("body")[0];
body_style = document.defaultView.getComputedStyle(body, "");