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
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb20iOnRydWUsIm91dHNpZGUiOnRydWUsIndvcmxkIjp0cnVlLCJzcGFjZVNoaXAiOnRydWV9fSwic3RvcmVzIjp7Indvb2QiOjY1MjUsIm1lYXQiOjU2MzAsImJhaXQiOjczOSwic2NhbGVzIjo2NywidGVldGgiOjUwNCwiZnVyIjoyMzAwNCwiY2xvdGgiOjIzNywiY2hhcm0iOjYsImN1cmVkIG1lYXQiOjQzMCwiY29tcGFzcyI6MSwibGVhdGhlciI6MTAxOCwibWVkaWNpbmUiOjUsImJvbmUgc3BlYXIiOjEsInRvcmNoIjo5NSwibCBhcm1vdXIiOjEsIndhdGVyc2tpbiI6MSwicnVja3NhY2siOjEsImlyb24iOjU4MiwiaXJvbiBzd29yZCI6MCwiY2FzayI6MSwid2Fnb24iOjEsInN0ZWVsIHN3b3JkIjoyLCJzdGVlbCI6NDU4LCJpIGFybW91ciI6MSwiY29hbCI6MjgzLCJidWxsZXRzIjo0NjcsImJvbGFzIjoyLCJzIGFybW91ciI6MSwiY29udm95IjoxLCJ3YXRlciB0YW5rIjoxLCJyaWZsZSI6NSwiYmF5b25ldCI6MCwic3VscGh1ciI6NDE0LCJhbGllbiBhbGxveSI6MCwiZW5lcmd5IGNlbGwiOjEyLCJsYXNlciByaWZsZSI6MX0sImNoYXJhY3RlciI6eyJwdW5jaGVzIjo0MCwic3RhcnZlZCI6MSwicGVya3MiOnsic3RlYWx0aHkiOnRydWUsInNjb3V0Ijp0cnVlfX0sImluY29tZSI6eyJnYXRoZXJlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJ3b29kIjoyNX0sInRpbWVMZWZ0Ijo4fSwiYnVpbGRlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJ3b29kIjoyfSwidGltZUxlZnQi |
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 Cow | |
def 🔪 | |
"🥩 " | |
end | |
end | |
🐄 = Cow.new | |
puts 🐄.🔪 # => 🥩 |
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
require 'minitest/autorun' | |
require 'minitest/emoji' | |
module MiniTest | |
class Emoji | |
add_utf_theme :carwow, 0x1f3ce, 0x1f694, 0x1f690, 0x1f6b6 | |
end | |
end | |
describe Cow do |
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 Array | |
alias ⏪ << | |
alias 🈴 concat | |
alias 💧 drop | |
alias 🔁 each | |
alias 🈳❓ empty? | |
alias 🍀 sample | |
alias 🎲 sample | |
alias ♻️ shuffle | |
alias 👈 push |
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 LeaseDeal < ApplicationRecord | |
def self.expire_all(time: Time.current) | |
update_all(expired_at: time) | |
end | |
end |
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
UPDATE "lease_deals" | |
SET "expired_at" = '2018–10–08 23:50:50.138061' | |
WHERE "lease_deals"."expired_at" IS NULL | |
AND "lease_deals"."dealership_id" = 1234 | |
AND ( updated_at < '2018–10–08 23:47:32.862470' ) |
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 LeaseDeal < ApplicationRecord | |
def self.expire_all(time: Time.current, batch_size: 1000) | |
in_batches(of: batch_size).update_all(expired_at: time) | |
end | |
end |
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
SELECT "lease_deals"."id" | |
FROM "lease_deals" | |
WHERE "lease_deals"."expired_at" IS NULL | |
AND "lease_deals"."dealership_id" = 1234 | |
AND ( updated_at < '2018-10-09 09:34:11.818701' ) | |
ORDER BY "lease_deals"."id" ASC | |
LIMIT 1000 |
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
Bitmap Heap Scan on lease_deals (cost=172.99..18520.04 rows=5903 width=205) | |
Recheck Cond: (dealership_id = 1234) | |
Filter: ((expired_at IS NULL) AND (updated_at < '2018-10-09 09:34:11.818701'::timestamp without time zone)) | |
-> Bitmap Index Scan on index_lease_deals_on_dealership_id (cost=0.00..172.70 rows=9724 width=0) | |
Index Cond: (dealership_id = 1234) |