Skip to content

Instantly share code, notes, and snippets.

View memememomo's full-sized avatar
🏠
Working from home

Uchiko memememomo

🏠
Working from home
  • Aichi, Japan
View GitHub Profile
@memememomo
memememomo / shell
Created August 5, 2014 06:59
Macでzsh起動時に「compdef: unknown command or service: git」というエラーが出る ref: http://qiita.com/uchiko/items/bf78ba08c60ac8ed551c
$ zsh
compdef: unknown command or service: git
compdef: unknown command or service: git
compdef: unknown command or service: git
compdef: unknown command or service: git
compdef: unknown command or service: git
compdef: unknown command or service: git
compdef: unknown command or service: git
$ compaudit | sudo xargs chmod g-w
There are insecure directories:
@memememomo
memememomo / sample.rb
Created July 24, 2014 11:04
Net::HTTP で、「end of file reached (EOFError)」というエラーが出た ref: http://qiita.com/uchiko/items/9e4ce392e9f9d5d2ddb8
parsed_url = URI.parse(url)
http = Net::HTTP.new(parsed_url.host, parsed_url.port)
http.use_ssl = true
@memememomo
memememomo / file0.txt
Created July 15, 2014 16:20
Connectを使った静的ファイル配信サーバが動かなくなった ref: http://qiita.com/uchiko/items/0c052c72d8ff402c3cea
has no method 'static'
let keyword = "swift"
let url = NSURL.URLWithString("http://api.atnd.org/events/?format=json&keyword="+keyword)
let session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
let task = session.dataTaskWithURL(url, completionHandler: {
(data, response, err) in
var dic = NSJSONSerialization.JSONObjectWithData(data, options:nil, error:nil) as NSDictionary
var events = dic["evants"] as NSArray
println(events)
})
task.resume()
@memememomo
memememomo / .zshrc
Created July 10, 2014 09:11
カレントディレクトリのnode_modulesにインストールしたコマンドを実行する ref: http://qiita.com/uchiko/items/2d827241603b085d6e12
alias npm-exec='PATH=node_modules/.bin:$PATH'
@memememomo
memememomo / sample.php
Created July 7, 2014 05:19
PHP版SQL::MakerでJSON SQL Injectionの対応版を出しました ref: http://qiita.com/uchiko/items/490aee47362ca39d603a
$builder = new SQL_Maker(array('driver' => 'mysql', 'strict' => 1));
$builder->select('user', array('*'), array('name' => sql_in(array('foo', 'bar'))));
// => SELECT * FROM `user` WHERE `name` IN (?, ?)
@memememomo
memememomo / .zshrc
Created July 3, 2014 02:51
oh-my-zsh の環境で、peco-select-history が動かない ref: http://qiita.com/uchiko/items/f6b1528d7362c9310da0
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
peco --query "$LBUFFER")
@memememomo
memememomo / Gemfile
Created July 2, 2014 13:31
Glint + WEBrick で一時的なWebサーバを立ててテストする ref: http://qiita.com/uchiko/items/5af8a8e643ba94a3dc8e
source 'https://rubygems.org'
gem 'glint'
gem 'rake'
gem 'rspec'
@memememomo
memememomo / config.rb
Created July 2, 2014 04:10
Rubyのハッシュ形式で記述された設定ファイルを読み込む ref: http://qiita.com/uchiko/items/7807d4282be29cc6d639
{
:username => 'hogehoge',
:password => 'hugahuga',
}
@memememomo
memememomo / app.psgi
Created June 12, 2014 07:49
FuelPHPのアプリをPlack上で動作させる ref: http://qiita.com/uchiko/items/76e06b27438cbec1f818
use Plack::App::CGIBin;
use Plack::App::PHPCGI;
use Plack::Builder;
use File::Zglob;
my $DOCROOT = 'public';
my $php_cgi = '';
$php_cgi ||= `which php-cgi`;
chomp($php_cgi);