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 / Rakefile
Created June 16, 2014 13:37
Rakefileにunicorn起動・停止のコマンドを追加する ref: http://qiita.com/teitei_tk/items/2f997d1b916905da6c80
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
namespace :unicorn do
##
# Tasks
##
desc "Start unicorn"
@teitei-tk
teitei-tk / file0.txt
Created September 7, 2014 16:47
GulpでCoffeeScript、Sassをコンパイル ref: http://qiita.com/teitei_tk/items/6a9833e4308b3769811d
$ npm install -g gulp
$ npm install --save-dev gulp gulp-coffee gulp-sass
@teitei-tk
teitei-tk / gist:506a526bd7c55b49befd
Created September 10, 2014 06:34
delete git all local branches
git branch | awk "{print$1}" | xargs git branch -D
@teitei-tk
teitei-tk / app.py
Created September 14, 2014 16:06
CentOS上でFlaskをpython3.4、Gunicorn + Nginxで動かす。 ref: http://qiita.com/teitei_tk/items/b223eeef1286a9fd7486
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@teitei-tk
teitei-tk / file0.txt
Created October 17, 2014 17:06
俺俺Gitのalias&ワンライナー集 ref: http://qiita.com/teitei_tk/items/699cef25a14db67ba8b7
[alias]
restart = reset --hard HEAD
set nohud
set nosmoothscroll
set typelinkhints
let searchlimit = 100
let scrollstep = 200
@teitei-tk
teitei-tk / gist:187a36cf01d50f15be1e
Created May 1, 2015 01:50
detect ios version number
<?php
$txt = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4';
$reg = '/iPhone OS ([0-9]+)_([0-9]+)/i';
preg_match($reg, $txt, $result);
$str_version = $result[1] . '.' . $result[2]; //This variable should now contain : 4.0
var_dump($result);
(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";