Skip to content

Instantly share code, notes, and snippets.

View migration_version_spec.rb
require 'rspec'
require 'rubocop'
require 'rubocop/rspec/support'
module RuboCop
module Cop
module Spree
module Migration
class Version < RuboCop::Cop::Base
extend AutoCorrector
View has_spree_webhooks.rb
require 'active_support/all'
require 'active_record'
require 'active_model'
require 'pry'
require 'state_machines-activerecord'
require 'state_machines-activemodel'
def setup_db
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: './main4.db')
ActiveRecord::Schema.define do
View viz.json
{"id":"06a4194c4b016917","slug":null,"trashed":false,"description":"","like":false,"likes":0,"publish_level":"private","forks":0,"fork_of":{"id":"17468271a273819d","slug":"visualizing-chess-games","title":"Visualizing chess games","owner":{"id":"9ba5e0b68d3e7972","github_login":"EE2dev","avatar_url":"https://avatars0.githubusercontent.com/u/7562919?v=4","login":"ee2dev","name":"","bio":"","home_url":"https://github.com/EE2dev/","type":"individual"},"version":698},"update_time":"2021-05-21T20:12:48.480Z","publish_time":null,"publish_version":null,"thumbnail":null,"default_thumbnail":null,"roles":["editor","owner"],"sharing":"private","subscription":"comments","edit_unpublished":false,"owner":{"id":"77ad7d1d53486a0d","github_login":"sebastian-palma","avatar_url":"https://avatars.githubusercontent.com/u/11888191?v=4","login":"sebastian-palma","name":"Sebastián","bio":"","home_url":"","type":"individual"},"creator":{"id":"77ad7d1d53486a0d","github_login":"sebastian-palma","avatar_url":"https://avatars.githubuserc
View includes.rb
[1] pry(main)> Site.includes(:site_links).where.not(site_links: { active: true })
SQL (0.7ms) SELECT "sites"."id" AS t0_r0, "sites"."name" AS t0_r1, "sites"."created_at" AS t0_r2, "sites"."updated_at" AS t0_r3, "site_links"."id" AS t1_r0, "site_links"."site_id" AS t1_r1, "site_links"."link_id" AS t1_r2, "site_links"."active" AS t1_r3, "site_links"."created_at" AS t1_r4, "site_links"."updated_at" AS t1_r5 FROM "sites" LEFT OUTER JOIN "site_links" ON "site_links"."site_id" = "sites"."id" WHERE "site_links"."active" != $1 [["active", true]]
=> [#<Site:0x0000560ffba92250 id: 1, name: "first", created_at: Sun, 28 Mar 2021 18:46:03.661861000 UTC +00:00, updated_at: Sun, 28 Mar 2021 18:46:03.661861000 UTC +00:00>,
#<Site:0x0000560ffba90428 id: 2, name: "second", created_at: Sun, 28 Mar 2021 18:46:06.263937000 UTC +00:00, updated_at: Sun, 28 Mar 2021 18:46:06.263937000 UTC +00:00>]
[2] pry(main)> Site.includes(:site_links).where.not("site_links.active = true")
Site Load (1.0ms) SELECT "sites".* FROM "sites"
View config.fish
set -x PATH $HOME/.rbenv/bin $PATH
rbenv init - | source
View main.log
version:1
:debug:sysinfo macOS 10.14 (darwin/18.6.0) arch i386
:debug:sysinfo MacPorts 2.6.3
:debug:sysinfo Xcode none
:debug:sysinfo SDK 10.14
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 10.14
:debug:main Found Dependency: path: /usr/bin filename: git regex: ^git$
:debug:main epoch: in tree: 0 installed: 0
:debug:main sbcl 2.0.6_0 exists in the ports tree
:debug:main sbcl 2.0.6_0 +fancy is the latest installed
View index_by_bm.md

Warming up -------------------------------------- Array#each 45.102k i/100ms Hash::[] 36.133k i/100ms Enumerable#map 38.767k i/100ms Enumerable#each_with_object 42.234k i/100ms Object#tap 42.185k i/100ms Enumerable#to_h 44.715k i/100ms Enumerable#index_by 41.212k i/100ms Calculating -------------------------------------

View asyncapi01.yml
asyncapi: 2.0.0
info:
title: Streetlights API
version: '1.0.0'
description: |
The Smartylighting Streetlights API allows you to remotely manage the city lights.
### Check out its awesome features:
* Turn a specific streetlight on/off 🌃
View mysql_limit_revert.md
$ bundle exec rails db:migrate
== 20191101233132 ExtendExecutionDatetimePrecision: migrating =================
-- change_column(:executions, :order_insert_time, :datetime, {:limit=>6})
   -> 0.0912s
== 20191101233132 ExtendExecutionDatetimePrecision: migrated (0.0913s) ========

➜  stack git:(master) ✗ bin/rails db -p
Reading table information for completion of table and column names