Skip to content

Instantly share code, notes, and snippets.

seiyamaeda seiyamaeda

Block or report user

Report or block seiyamaeda

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 data_extraction.rake
require "csv"
namespace :extract_hoge do
desc 'Data extraction'
task extraction: :environment do
p 'start task'
hoges = Hoge.all.order(id: :asc)
CSV.open('path/to/hoge.csv','w') do |row|
hoges.each do |hoge|
row << [ hoge.id, hoge.name, hoge.tel ] if hoge.tel.present?
View radio_button_with_label.rb
<div class="form-check form-check-inline">
<%= f.collection_radio_buttons(:hoge_id, @hoges, :id, :name) do |b| %>
<%= b.label(class: 'form-check-label', 'data-value': b.value) { b.radio_button(class: 'form-check-input') + b.text } %>
<% end %>
</div>
@seiyamaeda
seiyamaeda / clean_local_branch.sh
Created May 11, 2017
ローカルブランチのお掃除
View clean_local_branch.sh
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
@seiyamaeda
seiyamaeda / link_to_ireko.rb
Created May 11, 2017
link_toを入れ子で
View link_to_ireko.rb
View git_config_global_alias.sh
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.fc fetch
git config --global alias.df diff
git config --global alias.gr grep
View git_settings.sh
git config --global user.name "Your Name"
git config --global user.email you@example.com
View only_send_email_to_user.rb
def send_email_to_user
email_params = {
subject: params[:subject],
to_email: params[:to_email],
from_email: params[:from_email],
description: params[:description],}
HogeMailer.send_email_to_user(email_params)
render :nothing => true
end
@seiyamaeda
seiyamaeda / input_on_click_focus.js
Created May 17, 2017
インプットをクリックでテキストを選択状態にする
View input_on_click_focus.js
$(document).ready(function(){
$('.jsInputOnClickFocus').focus(function(){
$(this).select();
});
});
@seiyamaeda
seiyamaeda / simple_select_with_hash.rb
Last active Jun 30, 2017
HASHから簡易選択 select, select_tag
View simple_select_with_hash.rb
<%= f.select :hoge_type, options_for_select(Hoge::TYPE_HASH.invert), { include_blank: '選択してください' }, { class: 'test', required: true } %>
<%= select_tag :hoge_type, options_from_collection_for_select(Hoge::TYPE_HASH.invert, :first, :last), { :include_blank => '選択してください' } %>
@seiyamaeda
seiyamaeda / contact_form_7_select_default.php
Last active Jun 30, 2017
WordPress Contact Form 7 selectのデフォルトを動的に
View contact_form_7_select_default.php
// ex) test_type = 'テスト1'
[select* test_type include_blank default:get "テスト1" "テスト2" "テスト3" "テスト4" "テスト5(test)"]
You can’t perform that action at this time.