Instantly share code, notes, and snippets.

View n1.slim
- @users.each do |user|
= user.profile // select * from profile
View rails.fish
function rails
docker-compose config --services >/dev/null ^/dev/null
switch $status
case 0
docker-compose exec app rails $argv
case '*'
if test -d bin
bin/rails $argv
else
set -l rails_cmd (which rails)
View yamama.sixel
Pq"1;1;486;516#0;2;97;97;97#1;2;97;97;94#2;2;94;91;91#3;2;94;88;88#4;2;91;85;85#5;2;91;82;82#6;2;85;69;69#7;2;78;60;60#8;2;78;56;56#9;2;75;56;56#10;2;82;63;63#11;2;88;75;75#12;2;85;72;72#13;2;88;78;78#14;2;82;66;66#15;2;97;94;94#16;2;94;94;94#17;2;78;78;78#18;2;63;63;63#19;2;47;47;47#20;2;85;85;85#21;2;66;66;66#22;2;28;28;28#23;2;31;31;31#24;2;38;38;38#25;2;75;75;75#26;2;91;91;91#27;2;88;88;88#28;2;41;41;41#29;2;69;69;69#30;2;72;72;72#0~~z!7~|!14~z!7~}!15~v!23~|!412~$#1??C!7?A!14?C!7?@!15?G!23?A-#0~~|!483~$#1??A-#0!486~-!17~}}!467~$#1!17?@@-#0!108~z!377~$#1!108?C-#0!486~-!486~-!486~-!486~-!242~^^NFFBB@@@#3??@#10?___?__??A#11A???G#6?O??_$#1!242?_!9?@#14!6?_#0!4?@@@BBFFNNN^^^!209~$#6!243?_??G?C??A#12!15?C#5!4?O??_$#8!244?__?G?C_?ccQOQ!4?AOAC?K?O?_?__$#13!244?O#2G???A???@!9?@??A?C?G??O??_$#7!245?OO?G?CcAA__?!4QO_?_C?GGOO_$#9!246?_oow!4WKM!6KM{Wwoo__$#4!247?C!7?@!6?@$#5!250?A!5?!6@-#0!237~NFB@!4?_ow{{}}}!10~}}{{wwwooo__???@B^!205~$#6!237?_!4?@!4?C???@#2!11?@?A#7@?A?CCG?H@@AG_#2_$#1!237?O#7_OKCA`??CAA@@#6!13?@?A?
View hoge_spec.rb
RSpec.configure do |config|
config.mock_with :rspec
end
class PriceCalc
def initialize(order)
@order = order
end
View test.rb
require 'rspec'
require 'minitest'
require 'minitest-power_assert'
module Minitest
module Assertions
prepend Minitest::PowerAssert::Assertions
end
end
View test.rb
require 'power_assert'
module RSpec
module PowerAssert
def power_assert(&block)
::PowerAssert.start(block) do |pa|
ret = pa.yield
unless ret
raise RSpec::Expectations::ExpectationNotMetError, "\nPowerAssert:\n#{pa.message_proc.call}"
end
View keyword.rb
def foo
:foo
end
def bar(foo = 1)
p foo #=> 1(2.1.1, 2.2.0)
end
def hoge(foo = foo)
p foo #=> :foo(2.1.1), nil(2.2.0)
View rspec.rb
describe User do
describe '#nanrakano_method' do
subject { described_class.new.nanrakano_method(args) }
context 'context a'
context 'context b'
# many many context ...
context 'context z' do
View redo.rb
namespace :db do
desc "Redo target timestamp newer migration."
task :redo_timestamp => :environment do
timestamp = ENV['TIMESTAMP']
files = Dir.glob("db/migrate/*.rb").map {|file|
md = file.split(File::SEPARATOR).last.match(/(^\d+)_\w+\.rb/)
[md[0], md[1].to_i]
}.select{|match| match[1] > timestamp.to_i }.map{|match| match[0]}
ENV['STEP'] = files.size.to_s
Rake::Task['db:migrate:redo'].invoke
View z.txt
HP100%、銃弾70%、ミニマップ、HUD表示なし
アタッカー
突撃兵か工兵のみ
USAS-12,FAMAS,アンダーバレルのM26不可
第二、第三拠点のMCOM破壊で勝利
アタッカーは1人(人数次第で2、3人)
ディフェンス
ナイフのみ