Skip to content

Instantly share code, notes, and snippets.

View hiroshineya's full-sized avatar

Hiroshi Neya hiroshineya

  • ---
  • Kyoto, Japan
View GitHub Profile
@hiroshineya
hiroshineya / logger.js
Created May 10, 2012 09:12
Javascript ConsoleLog
// need jquery
function printLog(str) {
if(!$.browser.msie) {
console.log(str);
}
};
function printWarn(str) {
if(!$.browser.msie) {
console.warn(str);
}
@hiroshineya
hiroshineya / gist:2652063
Created May 10, 2012 09:17
get cookie with javascript
// Cookie取得
// key:Cookie key
// return: Cookie value. if not found, false.
function getCookie(key){
if(key){
var cookieData = document.cookie + ";";
var startPoint1 = cookieData.indexOf(key);
var startPoint2 = cookieData.indexOf("=",startPoint1)+1;
var endPoint = cookieData.indexOf(";",startPoint1);
if(startPoint2 < endPoint && startPoint1 > -1){
@hiroshineya
hiroshineya / gist:2652086
Created May 10, 2012 09:20
check iOS with javascript
// check ios
// return: true=ios. false=other.
function isIOS() {
var ua = navigator.userAgent;
var res = false;
if(ua.indexOf('iPhone') > -1 || ua.indexOf('iPad') > -1 || ua.indexOf('iPod') > -1) {
res = true;
}
return res;
};
@hiroshineya
hiroshineya / gist:2692512
Created May 14, 2012 07:43
元利均等返済年間返済額算出
/**
* 元利均等返済年間返済額算出
* 金利の目安
* http://www.flat35.com/kinri/index.php/rates/top (2012/05現在)
* 【フラット35】
* 返済期間が21年以上35年以下の場合の金利幅 2.070%~3.020%
* (取扱金融機関が提供する金利で最も多いのは2.070%)
* 返済期間が20年以下の場合の金利幅 1.760%~2.710%
* (取扱金融機関が提供する金利で最も多いのは1.760%)
* 【フラット50】
@hiroshineya
hiroshineya / gist:2709017
Created May 16, 2012 09:22
upload file to GoogleDocs
#!/usr/bin/python
# -*- coding: utf-8 -*-
# upload (bin)file to Google Docs.
#
import sys
import datetime
import os
import os.path
import time
@hiroshineya
hiroshineya / gist:2716964
Created May 17, 2012 06:23
retrieve file list from GoogleDocs
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import datetime
import os
import os.path
import time
import atom
@hiroshineya
hiroshineya / gist:3174261
Created July 25, 2012 03:50
openpyxl howto
#!/usr/bin/python
# -*- coding: utf-8 -*-
from openpyxl import load_workbook
if __name__ == "__main__":
print 'start.'
print ''
wb = load_workbook('load_test.xlsx')