Skip to content

Instantly share code, notes, and snippets.

View katapad's full-sized avatar

Yoshio Kakehashi katapad

View GitHub Profile
@katapad
katapad / convert.coffee
Last active December 11, 2015 11:28
jsファイルをcoffeeに変換 expressとかで作られたjsをまるっとcoffeeに変換します。 元のjsは削除です
js2coffee = require 'js2coffee'
glob = require "glob"
fs = require "fs"
glob "{*.js,!(node_modules)/**/*.js}", null, (er, files) ->
converted = []
for file in files
newName = file.substr(0, file.lastIndexOf('.')) + '.coffee'
@katapad
katapad / gist:4631917
Created January 25, 2013 05:01
IDEAでのFlash作成時のコンパイルオプション
-define=CONFIG::debug,true -define=CONFIG::release,false -default-size 950 600 -default-frame-rate 48 -default-background-color 0
@katapad
katapad / gist:4662479
Created January 29, 2013 07:32
いつも忘れる 固定JSONPのやりかた
$.ajax
url: "#{url}"
dataType: "jsonp"
jsonp: false
cache: false
jsonpCallback: 'callback'
success: (data) ->
console.log 'success', data
error: (data) ->
console.log 'err'
@katapad
katapad / gist:4670432
Created January 30, 2013 03:43
=>をいれるところ
class Unko
count: 0
start: ->
@loop()
loop: ->
setTimeout =>
@count++
console.log(@count);
@katapad
katapad / gist:4727618
Created February 7, 2013 01:31
TumblrでのGIFアニ 送信後→サーバー側のリサイズエラーでのレスポンス
{
"meta" :
{
"status" : 200,
"msg" : "OK"
},
"response" :
[
{
"original_filename" : "_wn.gif",
@katapad
katapad / gist:4738171
Created February 8, 2013 11:06
minmatch。grunt watchでnode_modulesとかを排除するときの書き方
files: ['**/*.js', '!public/**/*.js', '!node_modules/**/*.js'],
@katapad
katapad / gist:4952643
Last active December 13, 2015 18:08
TumblrでGIFアニアップしたときのエラー upload_photo
{
"meta" :
{
"status" : 200,
"msg" : "OK"
},
"response" :
[
{
"original_filename" : "test_shoot2_400-df.gif",
@katapad
katapad / configManager.coffee
Created February 22, 2013 13:26
jsonをマージするやつ
fs = require 'fs'
_ = require 'underscore'
$ = require 'jquery'
_mergeConfig = (base, merge)->
base = _.clone(base)
result = $.extend(true, {}, base, merge);
return result
@katapad
katapad / file0.txt
Created February 28, 2013 11:51
Facebook Javascript SDKのFeedDialogの大きさが2倍になるバグに対処する ref: http://qiita.com/items/ed89da2caee106b34ebd
var bodyW = $('body').css('width');
var css = document.styleSheets.item(0);
var idx = document.styleSheets[0].cssRules.length;
css.insertRule("body.android #fb-root .fb_dialog_mobile iframe { width:"
+ bodyW + " !important; }", idx);
@katapad
katapad / gist:5087870
Created March 5, 2013 03:51
Objectをcloneする方法。 prototypeにつっこんでnewとか、jQueryのextendでやるとかあるけど、これが一番シンプルで確実。
clone = (obj)->
return JSON.parse(JSON.stringify(obj))