Skip to content

Instantly share code, notes, and snippets.

@kyo-ago
kyo-ago / 日付を固定長に変換
Created July 20, 2010 02:30
日付を固定長に変換
function YYYYMMDD (d) { return [d.getFullYear(), '0' + (d.getMonth() + 1), '0' + d.getDate()].join('-').replace(/-\d(\d\d)/g, '-$1'); };
@kyo-ago
kyo-ago / gist:518516
Created August 11, 2010 05:16
逐次実行
$('#hoge1').delay(700).fadeIn(500, function () {
$('#hoge2').delay(700).fadeIn(500, function () {
$('#hoge3').delay(700).fadeIn(500);
});
});
@kyo-ago
kyo-ago / gist:569543
Created September 8, 2010 02:58
click_wrapper
$().ajaxSend(function () {
if ($('#click_wrapper').length) return;
$('<div id="click_wrapper">').appendTo('body').css('opacity', 0);
}).bind('ajaxComplete', function () {
setTimeout(function () {
$('#click_wrapper').remove();
}, 500);
});
$('body').live('pageAnimationStart', function () {
if ($('#click_wrapper').length) return;
@kyo-ago
kyo-ago / gist:591381
Created September 22, 2010 08:55
getScrollTop, getScrollLeftの設定
/**
* getScrollTop, getScrollLeftの設定
* @returns scroll position
*/
$.each([['Top', 'Y'], ['Left', 'X']], function () {
var name = this;
$[('getScroll' + name[0])] = function () {
var b = document.body['scroll' + name[0]] || 0;
var e = document.documentElement['scroll' + name[0]] || 0;
var s = window['scroll' + name[1]] || 0;
@kyo-ago
kyo-ago / gist:854008
Created March 4, 2011 01:43
YQLを使った外部ドメイン画像のData Scheme読み込み
var yql = function(qry, suc, err){
var c = "_" + (+new Date),
s = document.createElement("script"),
t;
var clean = function(){
s.parentNode.removeChild(s);
window[c] = null;
try{
delete window[c];
}catch(err){}
@kyo-ago
kyo-ago / gist:942028
Created April 26, 2011 09:21
文字列入れるの数値演算
.forEach(function (f) { console.log("\t\t\t'"+f.replace(/\s(\d+)/,function(a,b){return ' '+(b-0+5)})+"',");});
@kyo-ago
kyo-ago / gist:942007
Created April 26, 2011 08:49
viewBox用数値計算コード
var s=18,e=71,f=29-32,b=Math.abs(f--)+1,a=[];while(f++){var t=s-((e-s)/b)*f;a.push(((t*10)|0)/10);};console.log(a.reverse().join('\n'));
@kyo-ago
kyo-ago / gist:986118
Created May 23, 2011 02:26
NILScript Hotstrokes実装
Main.createNotifyIcon();
/*
with(require('Keyboard')){
for each(let [n,v] in Iterator(Keyboard.codes)){
println('Alias: '+(n+' ').slice(0,16)
+' / Code: 0x'+(('0'+v.toString(16)).slice(-2))
+' / ScanCode: 0x'+(('00'+(new Key(n)).scanCode.toString(16)).slice(-3))
+' / Name: '+(new Key(n)).name);
}
@kyo-ago
kyo-ago / jquery-animate-css-rotate-scale
Created June 1, 2011 15:05
jquery-animate-css-rotate-scale
/*!
* jquery-animate-css-rotate-scale
* Zachary Johnson
* www.zachstronaut.com
* https://github.com/zachstronaut/jquery-animate-css-rotate-scale/
* This code is currently available for use in all personal or commercial projects
* under both MIT and GPL licenses, just like jQuery.
*
* modified by @kyo_ago 2011-06-02
*/
@kyo-ago
kyo-ago / gist:1028841
Created June 16, 2011 07:34
set window.requestAnimationFrame
(function (w, r) {
w['r'+r] = w['r'+r] || w['webkitR'+r] || w['mozR'+r] || w['msR'+r] || w['oR'+r] || function(c){ w.setTimeout(c, 1000 / 60); };
})(window, 'equestAnimationFrame');