Skip to content

Instantly share code, notes, and snippets.

Working from home

Maechan maecha

Working from home
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)'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 %>
maecha /
Created May 11, 2017
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
maecha / link_to_ireko.rb
Created May 11, 2017
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
maecha / input_on_click_focus.js
Created May 17, 2017
View input_on_click_focus.js
maecha / simple_select_with_hash.rb
Last active Jun 30, 2017
HASHから簡易選択 select, select_tag
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 => '選択してください' } %>
maecha / 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)"]
maecha / seattleWeather_1948-2017.ipynb
Created Feb 28, 2018
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.