Skip to content

Instantly share code, notes, and snippets.

@furaji
furaji / zsh_install.markdown
Last active August 29, 2015 14:00
zshのインストール

$ sudo yum -y install zsh

現在のログイン・シェル確認

$ echo $SHELL

利用可能なシェルの一覧

@furaji
furaji / _description.markdown
Last active August 29, 2015 14:00
RailsでSingle Table Inheritance
@furaji
furaji / main.rb
Created July 3, 2014 12:16
githubのissueを複製する
require "octokit"
before_rep = "name/repname"
after_rep = "other_name/other_repname"
client = Octokit::Client.new(access_token: ENV["GITHUB_API_TOKEN"])
options = {
state: :all
@furaji
furaji / rbenv.markdown
Last active August 29, 2015 14:05
rbenv install
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bashrc

exec $SHELL
@furaji
furaji / singleton.js
Created September 4, 2014 08:18
jsでシングルトンのクラス
var Hoge;
(function() {
var instance;
Hoge = function Hoge(argument1, argument2) {
if (instance) {
return instance;
}
instance = this;
@furaji
furaji / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@furaji
furaji / file0.txt
Last active August 29, 2015 14:19
Ruby - LotusのControllerをRailsっぽく1ファイルにまとめたい ref: http://qiita.com/furajium/items/a8ec47926cefab9b2f90
# apps/web/config/routes.rb
get '/', to: 'home#index'
get '/show', to: 'home#show'
@furaji
furaji / application_form.rb
Created April 24, 2019 12:32
ActiveRecord モデルの validates をコピー
class ApplicationForm
include ActiveModel::Model
include ActiveModel::Attributes
def self.copy_validations_from(model)
attribute_types.keys.each do |key|
model.validators_on(key).each do |validator|
validates(key, validator.kind => validator.options)
end
end
@furaji
furaji / migrate
Created September 11, 2019 04:41
ridgepole_migrate
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@furaji
furaji / application_form.rb
Last active June 29, 2023 07:50
Rails Base Object
class ApplicationForm
include ActiveModel::Model
include ActiveModel::Attributes
def self.copy_validations_from(model)
attribute_types.keys.each do |key|
model.validators_on(key).each do |validator|
validates(key, validator.kind => validator.options)
end
end