Instantly share code, notes, and snippets.

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)'path/to/hoge.csv','w') do |row|
hoges.each do |hoge|
row << [,, ] if
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 %>
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
View link_to_ireko.rb
git config --global status
git config --global checkout
git config --global branch
git config --global commit
git config --global alias.fc fetch
git config --global alias.df diff
git config --global grep
git config --global "Your Name"
git config --global
View input_on_click_focus.js
View simple_select_with_hash.rb
<%= :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 => '選択してください' } %>
View contact_form_7_select_default.php
// ex) test_type = 'テスト1'
[select* test_type include_blank default:get "テスト1" "テスト2" "テスト3" "テスト4" "テスト5(test)"]
View seattleWeather_1948-2017.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.