Skip to content

Instantly share code, notes, and snippets.

View watagashi's full-sized avatar
🏠
Working from home, except for the weekend.

WADA Takashi watagashi

🏠
Working from home, except for the weekend.
View GitHub Profile
var a = ['a', 'b', 'c'];
var b = ['x', 'y', 'z'];
var c = a.concdat(b,true);
a.push('d');
var c = a.join('');
var a = ['a', 'b', 'c'];
var c = a.pop();
Function.prototype.method = function (name, func) {
if (!this.prototype[name]) {
this.prototype[name] = func;
return this;
}
};
Array.method('reduce', function (f, value) {
var i;
for (i = 0; i < this.length; i+= 1) {
// Merged to master
// https://github.com/NeoCat/twicli/commit/24f73ae0ea054a33ed3e5ff83da28aaab641a061
powershell.exe -Command "& {Get-ChildItem|Where-Object{$_.Name -notmatch '^\.hg'}|Remove-Item -Recurse}"
[merge-tools]
gvimdiff.executable = gvim
gvimdiff.diffargs = -d $parent $child
gvimdiff.diff3args = -d $parent1 $child $parent2
gvimdiff.gui = True
exe 'g/\/CropBox\s*\[\s*\zs\([0-9.]\+\s*\)\{4}\]/norm /'.nr2char(13).'30'.nr2char(1).'W30'.nr2char(1).'W30'.nr2char(24).'W30'.nr2char(24)
@echo off
setlocal
set target=vimexe
set vim=vim
if exist %target% (
echo %target% is already exist.
goto end
)
if exist %target%.zip (
echo %target%.zip is already exist.
" msysGit
if executable($ProgramFiles . '\Git\bin\git.exe')
let g:VCSCommandGitExec= $ProgramFiles . '\Git\bin\git.exe'
endif
" TortoiseHg for Windows
if executable($ProgramFiles . '\TortoiseHg\hg.exe')
let g:VCSCommandHGExec= $ProgramFiles . '\TortoiseHg\hg.exe'
endif
@watagashi
watagashi / retry.js
Created March 6, 2011 12:33
twicli でクロスドメイン JavaScript コールバックのデフォルトのリトライ回数を変更。
xds.retry = 1;
xds.load_default = function(url, callback, old, callback_key) {
this.abort(old);
return this.load(url, callback, twFail, this.retry, callback_key);
};
xds.load_for_tab = function(url, callback, callback_key) { // タブ切替時に自動abort
var ifr_tab = this.ifr_tab;
var fr = [this.load(url,
function() { callback.apply(this,arguments); try { ifr_tab.remove(fr[0]); } catch(e) {} },
function() { twFail(); try { ifr_tab.remove(fr[0]); } catch(e) {} },
@watagashi
watagashi / gist:818566
Created February 9, 2011 14:33
twicli で北緯34.9度、東経138.3度 (小数点第2位以下切り捨て) を抽出する例。
geo::{return (g=this.geo)&&Math.floor(g.coordinates[0]*10)==349&&Math.floor(g.coordinates[1]*10)==1383}:0