This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# To test is using `defaults.merge(options)` or `defaults.merge!(options)` | |
# is faster, I ran the following: | |
Benchmark.bm(7) do |x| | |
x.report("#merge:") do | |
10000000.times do | |
defaults = {:a => 1, :b => 2, :c => 3, :d => 4} | |
options = {:a => "another value", :d => true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Water | |
attr_reader :temperature, :amount | |
def initialize(temperature:, amount:) | |
@temperature = temperature | |
@amount = amount | |
end | |
def +(other) | |
total_amount = self.amount + other.amount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pbCopy = (text) => { | |
const tmp = document.createElement('div'); | |
const pre = document.createElement('pre'); | |
pre.style.webkitUserSelect = 'auto'; | |
pre.style.userSelect = 'auto'; | |
tmp.style.position = 'fixed'; | |
tmp.style.right = '200%'; | |
tmp.appendChild(pre).textContent = text; | |
document.body.appendChild(tmp); | |
document.getSelection().selectAllChildren(tmp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
format: | |
subject: '# :sp: %{subject}' | |
line: '* :github: [%{title}](%{url}) by [:@%{user}:](https://github.com/%{user}) %{status}' | |
dictionary: | |
status: | |
merged: ':done:' | |
closed: ':done:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 使用例 | |
function example() { | |
renderQueryResult('シート名', query(), 'A2', 'U1'); | |
} | |
// SQL は <xml><![CDATA[;]] で囲むと吉。 | |
function query() { | |
return <xml><![CDATA[ | |
select | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inherit_from: .rubocop_todo.yml | |
Rails: | |
Enabled: true | |
# for Rails 3.2 | |
Rails/ActionFilter: | |
Enabled: false | |
# for Rails 3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE | |
# - spec/rails_helper.rb | |
# RSpec.configure do |config| | |
# config.include FeatureSpecMacro, type: :feature | |
# end | |
module FeatureSpecMacro | |
RSpec.configure do |config| | |
config.before(:suite) do | |
unless ENV['CIRCLE_ARTIFACTS'] | |
if Dir.exist? File.join('tmp', 'screenshot') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }, | |
{ "keys": ["ctrl+pagedown"], "command": "next_view_in_stack" }, | |
{ "keys": ["ctrl+pageup"], "command": "prev_view_in_stack" }, | |
{ "keys": ["super+shift+n"], "command": "advanced_new_file"}, | |
{ "keys": ["shift+delete"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"auto_find_in_selection": true, | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 13, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"rulers": | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_insert_into(model_class) | |
model_class.all.each do |record| | |
print "insert into #{model_class.table_name} values (" | |
model_class.columns.each_with_index do |col, idx| | |
print ", " unless idx == 0 | |
print "#{sql record.public_send(col.name)}" | |
end | |
puts ");" | |
end | |
end |
NewerOlder