Skip to content

Instantly share code, notes, and snippets.

View ngtk's full-sized avatar
🕺
Being dancing to AI's tune

Kento Nagata ngtk

🕺
Being dancing to AI's tune
View GitHub Profile
@ngtk
ngtk / responsive-design-sokushu.md
Last active June 23, 2016 11:56
2016/06/27 Responsive design sokushu kai

メモメモ

感想

  • Railsは環境構築的にハードル高い感じだった
    • 参加者のレベルを把握する必要があるかも
  • みなみくん喋るの早いw
@ngtk
ngtk / status_code_snippets_generator.rb
Last active January 24, 2016 02:49
generate ruby.rack.status_code.snip
require 'rack'
File.open "ruby.rack.status_code.snip", "w" do |out|
Rack::Utils::HTTP_STATUS_CODES.each do |code, message|
symbol = message.downcase.gsub(/\s|-|'/, '_').to_sym
out.write <<-EOL
snippet #{symbol}
abbr #{code} #{message}
options word
:#{symbol}
@ngtk
ngtk / singleton_class.rb
Created January 14, 2016 09:05
Singleton Class
puts <<-EOL
1. finding method
EOL
class C
def a_method
'C#a_method'
end
@ngtk
ngtk / .pryrc
Last active December 25, 2015 14:36
Pryで日本語リプサムとしてaozoraを使う ref: http://qiita.com/ngtk/items/51ebf0cc7f7b9d498c16
require 'aozora'
Aozora.titles.each do |title|
define_method(title) do |size = 100|
Aozora.public_send(title, size)
end
end
@ngtk
ngtk / monkey_patch_pattern.rb
Created November 4, 2015 04:07
monkey patch pattern
class Human
def say
puts "hello"
end
end
module AnyModule
class ::Human
def say
puts "hooooo!!!"
@ngtk
ngtk / refinements_pattern.rb
Created November 4, 2015 03:34
refinements pattern
class Human
def say
puts "hello"
end
end
module PartyPeople
refine Human do
def say
puts "hooooo!!!"
@ngtk
ngtk / file0.txt
Last active August 30, 2015 10:06
Phoenixインストールまで ref: http://qiita.com/ngtk/items/958f35de8c48659f2463
$ brew install elixir
$ elixir -v
Elixir 1.0.5
$ brew install postgresql
$ createdb # データベース追加
$ createuser postgres # postgresユーザを追加
$ psql
(username)=\# ALTER USER postgres CREATEDB; # DB作成できるように
@ngtk
ngtk / tmux-ssh
Created August 28, 2015 02:29
tmux-ssh
#! /bin/zsh
tmux set-window-option -g window-status-current-bg yellow
ssh $1
tmux set-window-option -g window-status-current-bg default
@ngtk
ngtk / block_sortable.rb
Created August 25, 2015 11:16
block sortable
module BlockSortable
def encode
[
matrix.map(&:last).join,
matrix.index(self)
]
end
def matrix
str = self.dup
#!/bin/bash
# Build tools and dependencies
sudo yum install git gcc gcc-c++ make openssl-devel -y
# Install RBENV
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile