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
@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 %
@teitei-tk
teitei-tk / invoke.cs
Created May 20, 2014 03:58
1秒間隔で処理を実行する
using UnityEngine;
using System;
public class InvokeCotroller : MonoBehaviour
{
public void Start()
{
this.InvokeRepeating("Hoge", 0f, 1.0f);
}
@teitei-tk
teitei-tk / database.yml
Created June 7, 2014 09:01
Vagrant(CentOS6.5)にRails4.1 + Nginx + Unicorn + MySQL環境でRailsを起動する。 ref: http://qiita.com/teitei_tk/items/74794983d9893c3e7a05
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: hoge
password: foobar
socket: /var/lib/mysql/mysql.sock
@teitei-tk
teitei-tk / application.css
Created June 10, 2014 14:36
Railsでtwitter bootstrapをsubmoduleとして管理 ref: http://qiita.com/teitei_tk/items/a3810a89233dc54a3277
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
@teitei-tk
teitei-tk / application.html.erb
Created June 15, 2014 15:32
Railsでvendor/assets/javascripts以下にあるファイルを特定のページでのみ使用する ref: http://qiita.com/teitei_tk/items/bf444c6aa6398bde83bf
....
<%= javascript_include_tag 'hoge.js', 'data-turbolinks-track' => true %>
....