Skip to content

Instantly share code, notes, and snippets.

View teitei-tk's full-sized avatar
💭
I 💟 🍛

Yoshikatsu Higa teitei-tk

💭
I 💟 🍛
View GitHub Profile
(function(){
var images = [
"http://24.media.tumblr.com/tumblr_li92qz4NtI1qhhb8uo1_400.jpg",
"http://24.media.tumblr.com/tumblr_m80ziwHwTZ1qz6rb1o1_500.jpg",
"http://25.media.tumblr.com/tumblr_m7m1lm8nqe1qbyxr0o1_500.png"
];
for (var i = 0, cnt = images.length; i < cnt; i++) {
new Image().src = images[i];
}
@teitei-tk
teitei-tk / yahooTextParseApiSample.php
Created October 22, 2012 14:21
Yahoo形態素解析APIのサンプル的なもの
<?php
$appid = "APP_ID";
$sentence = mb_convert_encoding("シュレーディンガーの猫(しゅれーでぃんがーのぬこ)とは、平行宇宙に無限に自分の虚像を投射することで存在していると考えられている、猫のような生物(UMA)ないし「存在」、もしくは「現象」あるいは「箱」である。「わけのわからないもの」とも。", 'utf-8', 'auto');
$filter = "1|2|3|4|5|9|10";
$data = http_build_query(array(
"appid" => $appid,
"sentence" => $sentence,
"filter" => $filter,
"result" => "ma"
@teitei-tk
teitei-tk / fizzbuzz.js
Created March 20, 2013 14:02
fizzbuzz@ js
(function(){
console.log( "start fizzbuzz...\n" );
var fizzbuzz, result = [];
for ( var i = 1; i <= 100; i++ ) {
if ( i % 3 === 0 && i % 5 === 0 ) {
fizzbuzz = "fizzbuzz";
} else if ( i % 3 === 0 ) {
fizzbuzz = "fizz";
@teitei-tk
teitei-tk / requirements.txt
Created November 2, 2013 13:38
pip librarylist
Flask==0.6.1
IPy==0.81
Jinja2==2.7
MarkupSafe==0.18
PIL==1.1.7
Powerline==beta
Pygments==1.6
Twisted==12.0.0
Werkzeug==0.8.3
altgraph==0.9
@teitei-tk
teitei-tk / gist:8777464
Created February 3, 2014 01:03
str型の文字を一文字ずつ書き出す
#/usr/bin/env python
def run():
target = "1234567890"
length = len(target)
for x in xrange(0, length):
print target[x-1:x]
if __name__ == "__main__":
run()
@teitei-tk
teitei-tk / random_string.py
Created February 3, 2014 06:30
make random_text
#!/usr/bin/env python
def random_string():
import string, random
return ''.join([random.choice(string.ascii_letters + string.digits) for i in range(50)])
if __name__ == "__main__":
print random_string()
@teitei-tk
teitei-tk / class.py
Created February 20, 2014 01:45
class methodの継承で一瞬迷ったのでおさらい。
#!/usr/bin/env python
class Hoge(object):
def run(self):
print "run as Hoge"
def second_run(self):
print "run as Hoge"
class Foo(Hoge):
@teitei-tk
teitei-tk / tweenPositionTest.cs
Created February 21, 2014 00:02
NGUI TweenPosition Example x 座標0 or 350にDURATION分の時間を使いながら移動。
using UnityEngine;
public class TweenPositionTest : MonoBehaviour
{
private GameObject tweenTarget;
public const float DURATION = 0.1f;
public void Start()
{
this.tweenTarget = GameObject.Find("TweenTarget");
#!/usr/bin/env python
import sys
import os
import commands
import glob
import fnmatch
def recursive_glob(treeroot, pattern):
results = []
@teitei-tk
teitei-tk / gist:3ce7bdf5a4971c11154f
Created May 2, 2014 09:40
gitのローカルブランチで特定の文字を含んでいるブランチを強制削除
# hoge branchを削除
git branch | grep hoge | xargs -I % git branch -D %