Skip to content

Instantly share code, notes, and snippets.

かとちん tkatochin

Block or report user

Report or block tkatochin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View git-push-current.sh
#!/bin/sh
git push origin `git rev-parse --abbrev-ref HEAD` -f
@tkatochin
tkatochin / git-pull-origin-all.sh
Last active Nov 29, 2018
master、ブランチを一括pull
View git-pull-origin-all.sh
#!/bin/sh
export current_branch=`git rev-parse --abbrev-ref HEAD`
if [ 0 == `git status | grep -E "nothing to commit, working (directory|tree) clean" | wc -l` ]; then
echo "管理外の未コミットのファイルがあるので中止します。"
exit 1;
fi
abs_dirname() {
@tkatochin
tkatochin / JSONP special
Created Sep 10, 2013
NeoCatさんの「JSONPのエラー検知(&リトライ)可能版。」いいね! http://d.hatena.ne.jp/NeoCat/20110206/1296934235 ※charset=utf-8だけ足した。
View JSONP special
// Thanks NeoCat http://d.hatena.ne.jp/NeoCat/20110206/1296934235
window.xds = {
load: function(url, callback, onerror, retry, callback_key) {
var ifr = document.createElement("iframe");
ifr.style.display = "none";
document.body.appendChild(ifr);
var d = ifr.contentWindow.document;
var cnt = 0;
ifr[ifr.readyState/*IE*/ ? "onreadystatechange" : "onload"] = function() {
if (this.readyState && this.readyState != 'complete' || cnt++) return;
@tkatochin
tkatochin / isUsingMultiAccounts.js
Created Sep 4, 2013
Googleアプリにスクリプトレットなどで流し込んで、マルチアカウントユーザーか否かを判断する
View isUsingMultiAccounts.js
// to be loaded AddToStringPrototypeStartsWithAndEndsWith.js
isMultiLogoned = function () {
tags = document.getElementsByTagName("a");
for (var i = 0; i < tags.length; i++) {
if (tags[i].rel == "noreferrer") {
if (tags[i].href != "" && (tags[i].href.indexOf("&authUser=") || tags[i].href.indexOf("?authUser="))) {
return true;
}
}
}
View AddToStringPrototypeStartsWithAndEndsWith.js
String.prototype.startsWith = function(prefix) {
return this.lastIndexOf(prefix, 0) == 0;
};
String.prototype.endsWith = function(suffix) {
return this.lastIndexOf(suffix) == this.length-suffix.length;
}
@tkatochin
tkatochin / __deploy_back.sh
Created Feb 24, 2012
自動的に認証しつつappgngineにGAE/Javaアプリをmvnビルド後にデプロイするシェル。詳細→ http://tkatochin.hatenablog.com/entry/2012/02/24/173853
View __deploy_back.sh
#!/bin/sh
echo mvn -P $1 $2 $3 $4 $5 -DdownloadSources=true -Dgwt.compile.skip=true eclipse:eclipse package
mvn -P $1 $2 $3 $4 $5 -DdownloadSources=true -Dgwt.compiler.skip=true eclipse:eclipse package
RETVAL=$?
if [ $RETVAL -eq 0 ]
then(
expect -c "
set timeout -1
spawn appcfg.sh --email=$GAE_USER --passin backends update war
expect Password\ for\ $GAE_USER:\ ; send \"$GAE_PASS\r\"
@tkatochin
tkatochin / testgadget.xml
Created Feb 24, 2012
Googleカレンダーで使用すると週・月以外で落ちるサンプルガジェット
View testgadget.xml
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="CanvasAndPrefSetSample" author="katochin">
<Require feature="setprefs"/>
<Require feature="views"/>
</ModulePrefs>
<UserPref datatype="hidden" display_name="test" name="testPref" />
<Content type="html" view="canvas">
<![CDATA[<!DOCTYPE html>
<head>
@tkatochin
tkatochin / gdata-deploy.sh
Created Mar 18, 2011
gdata-java-clientをダウンロードして全てのライブラリをデプロイするシェル。
View gdata-deploy.sh
#!/bin/sh
if [ $# -ne 3 ]; then
echo "usage...: $0 gdata-version repository-url repository-id"
echo "ex.) $0 1.43.0 http://mylocal-nexus/content/repositories/thirdparty deploy-thirdparty"
exit 1
fi
curl -O http://gdata-java-client.googlecode.com/files/gdata-src.java-$1.zip
unzip gdata-src.java-$1.zip
cd gdata/java/src
zip -r ../lib/sources.jar com
You can’t perform that action at this time.