Skip to content

Instantly share code, notes, and snippets.

@ykpythemind
ykpythemind / .rubocop.yml
Last active July 26, 2017 06:23
rubocop.yml
# Use only ascii symbols in comments.
AsciiComments:
Enabled: false
LineLength:
Max: 140
AllCops:
TargetRubyVersion: 2.3
Style/FrozenStringLiteralComment:
Enabled: false
Style/NumericLiteralPrefix:
a = ['大化','白雉','朱鳥','大宝','慶雲','和銅','霊亀','養老','神亀','天平','天平感宝','天平勝宝','天平宝字','天平神護','神護景雲','宝亀','天応','延暦','大同','弘仁','天長','承和','嘉祥','仁寿','斉衡','天安','貞観','元慶','仁和','寛平','昌泰','延喜','延長','承平','天慶','天暦','天徳','応和','康保','安和','天禄','天延','貞元','天元','永観','寛和','永延','永祚','正暦','長徳','長保','寛弘','長和','寛仁','治安','万寿','長元','長暦','長久','寛徳','永承','天喜','康平','治暦','延久','承保','承暦','永保','応徳','寛治','嘉保','永長','承徳','康和','長治','嘉承','天仁','天永','永久','元永','保安','天治','大治','天承','長承','保延','永治','康治','天養','久安','仁平','久寿','保元','平治','永暦','応保','長寛','永万','仁安','嘉応','承安','安元','治承','養和','寿永','元暦','文治','建久','正治','建仁','元久','建永','承元','建暦','健保','承久','貞応','元仁','嘉禄','安貞','寛喜','貞永','天福','文暦','嘉禎','暦仁','延応','仁治','寛元','宝治','建長','康元','正嘉','正元','文応','弘長','文永','建治','弘安','正応','永仁','正安','乾元','嘉元','徳治','延慶','応長','正和','文保','元応','元亨','正中','嘉暦','元徳','元弘','元徳','正慶','建武','暦応','康永','貞和','観応','文和','延文','康安','貞治','応安','永和','康暦','永徳','至徳','嘉慶','康応','明徳','応永','永享','嘉吉','文安','宝徳','康正','長禄','寛正','文正','応仁','文明','長享','延徳','明応','文亀','永正','大永','享禄','天文','弘治','永禄','元亀','天正','文禄','慶長','元和','寛永','正保'
'use babel';
// for Rails haml view file
const setTabTitle = () => {
const tabs = atom.views.getView(atom.workspace).querySelectorAll('.vertical li.tab .title');
Array.from(tabs, (tab) => {
if (tab.innerText.match(/\.(haml|erb)/)) {
tab.innerText = tab.dataset.path.split(path.sep).slice(-2).join('/').replace(/\.html\.(haml|erb)/, '');
@ykpythemind
ykpythemind / fujirock_bookmark_let.js
Last active July 25, 2018 12:06
フジロックTT・ブックマークレット / 新規ブックマーク→ URLに以下の内容をコピペして保存 → フジのタイムテーブルページ(http://www.fujirockfestival.com/artist/timetable/tt27.asp )で保存したブックマークレット開く → 見る予定のアーティストの名前をクリックしていく → 左上の「TT表示」を押す)
javascript: (function() { window.s = [jQuery('[name="timetable"] :selected').text()]; window._init = function() { var im = jQuery('td.stageGreen'); im.html("TT表示"); im.on('click', function() { window._b=window.document.body.innerHTML; window.document.body.innerHTML = window.s.join("<br>") + "<br><br><a href='javascript: window.document.body.innerHTML = window._b; window._init();'>【閉】</a>" }); jQuery('td > a').on('click', function(e){ e.preventDefault(); var j=jQuery(this).parent(); window.s.push('', '* ' + j.attr('class')+' <b>'+ j.text()+'</b>'); j.attr("class", ""); }); }; window._init(); })();
@ykpythemind
ykpythemind / alias_for_rails_and_docker.md
Last active August 31, 2018 15:03
direnv + docker-compose for Rails

Docker環境でもRailsコマンドを短く使う

docker-compose run --rm app rails db:migrate 〜 みたいなのをうつのがめんどいので

requirements

  • direnv
  • docker-compose
@ykpythemind
ykpythemind / slim_ruby_syntax_checker.rb
Created December 11, 2019 14:12
slimファイル中のRubyのSyntaxErrorのみ検証するrake task
# CIで実行されない行があると死んだりするので、それの検証用
desc 'slim_lintを用いてslimファイル中のRubyのSyntaxErrorのみ検証する'
task slim_lint_syntax: :environment do
result = `bundle exec slim-lint app/views/`
if $?.exitstatus != 0 && $?.exitstatus != 65 # rubocop:disable Style/SpecialGlobalVars
# https://github.com/sds/slim-lint/blob/79f388a3a3c2ee43ed8cdbaf63fb56038498370c/lib/slim_lint/cli.rb#L86
abort "slim_lint failed. #{result}"
end
@ykpythemind
ykpythemind / shairport_sync_up
Last active January 19, 2020 16:10
shairport sync up
#!/usr/bin/env ruby
def shairport!
system "shairport-sync -d"
end
pidfile = "/usr/local/var/run/shairport-sync.pid"
if File.exist?(pidfile)
pid = File.read(pidfile).chomp
リピート入力認識までの時間 キーのリピート
default確認 defaults read -g InitialKeyRepeat defaults read -g KeyRepeat
変更コマンド defaults write -g InitialKeyRepeat -int 14 defaults write -g KeyRepeat -int 2
画面上で設定した時の最速値 15 = 225ms 2 = 30ms

設定したらログアウト

https://go.googlesource.com/image/+archive/master/font/gofont/ttfs.tar.gz
@ykpythemind
ykpythemind / Gemfile
Created June 25, 2020 09:00 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers