Skip to content

Instantly share code, notes, and snippets.

🏳️
Focusing

Yasuhiko Katoh yatmsu

🏳️
Focusing
Block or report user

Report or block yatmsu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View yo.thor
require 'thor'
class Gist < Thor
desc 'yo', 'gist sample task'
def yo
puts 'hey!'
end
end
@yatmsu
yatmsu / application_controller.rb
Last active Aug 29, 2015
app/controllers/application_controller.rb
View application_controller.rb
class ApplicationController < ActionController::Base
private
# ActionMailerのdefault_url_optionsを変更する
def set_default_url_options; ActionMailer::Base.default_url_options[:host] = request.host_with_port end
end
class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
before_action :set_default_url_options, only: [:create, :update]
@yatmsu
yatmsu / application_form_builder_spec.rb
Last active Sep 15, 2015
spec/forms/application_form_builder_spec.rb
View application_form_builder_spec.rb
require 'rails_helper'
RSpec.describe ApplicationFormBuilder do
describe '#select_genders' do
let(:user) { User.create(name: 'name', gender: 'male') }
let(:builder){ ApplicationFormBuilder.new :user, user, ActionView::Base.new, {} }
it {
expect(builder.select_genders).to eq '<select name="user[gender]" id="user_gender"><option selected="selected" value="male">male</option>
@yatmsu
yatmsu / application_form_builder.rb
Created Jan 25, 2015
app/forms/application_form_builder.rb
View application_form_builder.rb
class ApplicationFormBuilder < ActionView::Helpers::FormBuilder
def select_genders(options = {}, html_options = {})
select :gender, [ [ 'male', 'male' ], [ 'fmale', 'fmale' ] ], options, html_options
end
end
@yatmsu
yatmsu / 0_reuse_code.js
Created Feb 20, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yatmsu
yatmsu / Gemfile
Created Feb 17, 2014
Gemfile(ginza.rb 08)
View Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
gem 'grape'
gem 'newrelic-grape'
gem 'rails', '4.0.1'
gem 'newrelic_rpm'
gem 'unicorn'
View unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production
@yatmsu
yatmsu / hello.rb
Last active Jan 27, 2018
メモメモ
View hello.rb
puts "俺もgistデビューだ!"
You can’t perform that action at this time.