Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
var write =function(name){console.log(name);};
var gg =0;
var z =0;
setTimeout(function(){write("bbb")},10);
setInterval(function(){write(gg++)},10);
for(var i=0;i<1000000;i++)z++;
{
"pop_host" : "host.com",
"pop_port" : 110,
"pop_userid" : "userid",
"pop_passwd" : "passwd"
}
function tokenize(str) {
str=str.replace(/\(/g,"( ");
str=str.replace(/\)/g," )");
arr = str.split(' ');
return arr;
}
function InputToLObject(arr){
var rtn;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 改変前ソース
# Pythonを使ってgoo.glの短縮URLを得る | TRIVIAL TECHNOLOGIES on CLOUD
# http://coreblog.org/ats/pythonic-way-of-obtaining-shorten-url-by-using-goo_gl
def google_shorten(url):
from re import match
from urllib2 import urlopen, Request, HTTPError, quote
try:
// user script for efreedom
// version 0.01 ALPHA!
// 2010-11-05
// First Commit
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
@masahitojp
masahitojp / font_manager.py
Created November 11, 2010 07:49
matplotlibがWindowsでエラーになる時の対応策
# http://docs.python.org/library/_winreg.html
# http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/font_manager.py?revision=8713&view=markup
# LINE 203に以下を追加
#except WindowsError:
# continue
#local = None
@masahitojp
masahitojp / dir2.py
Created November 17, 2010 08:24
dir2
# aodag先生のdir2
# http://d.hatena.ne.jp/a2c/20100504/1272903592
dir2 = lambda y:[x + ("*" if callable(getattr(y, x)) else "") for x in dir(y)]
@masahitojp
masahitojp / gist:706164
Created November 19, 2010 05:44
flask_mobile.py
from flask import Flask,request,g
#from middleware import SimpleMiddleware
app = Flask(__name__)
@app.before_request
def before_request():
from uamobile import detect
g.d = detect({'HTTP_USER_AGENT': request.headers["User-Agent"]})
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from igo.Tagger import Tagger
class ZenraIgo(object):
def __init__(self, dataDir, position=u'動詞', text=u'全裸で'):
self.dataDir = dataDir
self.position = position
self.text = text
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def inverted_index(index,no,str):
str_arr =str.split(" ")
for i in range(len(str_arr)):
try:
index[str_arr[i]]
except KeyError: