Skip to content

Instantly share code, notes, and snippets.

View connorshea's full-sized avatar
:shipit:
Shipping

Connor Shea connorshea

:shipit:
Shipping
View GitHub Profile
@connorshea
connorshea / README.md
Last active May 2, 2020 22:04
Grouvee-to-vglist Importer Script

This script is meant to be used to transfer a game library from Grouvee to vglist. :)

Import instructions:

  1. Save grouvee_to_vglist_importer.rb locally.
  2. Export your Grouvee library to a CSV file and save it as grouvee.csv in the same directory as grouvee-to-vglist-import.rb.
  3. Create an account on vglist.co if you haven't already.
  4. In your vglist settings, click "Developer" in the left sidebar.
  5. Click "View Token" and copy the token shown.
  6. Check your Ruby version (ruby -v).
@connorshea
connorshea / pcgw_mobygames.json
Last active December 22, 2019 19:44
A script for creating a JSON file from a SPARQL query with all video games on Wikidata that have PCGW IDs and MobyGames IDs. Also, the JSON file.
[
{
"name": "Civilization",
"wikidata_id": "Q368286",
"mobygames_ids": [
"civilization",
"sid-meiers-civilization"
],
"pcgw_id": "Civilization"
},
@connorshea
connorshea / README.md
Created December 5, 2019 04:34
Faker RBI

faker.rbi generation:

  • bundle exec sord faker.rbi --no-sord-comments --replace-errors-with-untyped --replace-unresolved-with-untyped --skip-constants
  • Replace all NOT_GIVEN with T.unsafe(nil).
    • This constant doesn't exist because we skipped generating constants, so we have to get rid of it.
  • Replace the line def self.negative(legacy_from = T.unsafe(nil), legacy_to = T.unsafe(nil), from: -5000.00,, to: -1.00)); end with def self.negative(legacy_from = T.unsafe(nil), legacy_to = T.unsafe(nil), from: -5000.00, to: -1.00); end
    • This line is butchered because of a bug in YARD with negative numbers as default values.
  • Replace all instances of String with ::String
    • These have to be done because otherwise Sorbet will thing we mean Faker::String >.>
    • Replace all returns(String) with returns(::String).
  • Replace all T.nilable(String) with T.nilable(::String).
@connorshea
connorshea / graphql-ruby.rb
Created October 17, 2019 02:42
RBI file for GraphQL Ruby
# typed: strong
# test_via: ../subscriptions.rb
module GraphQL
ID_TYPE = T.let(GraphQL::Types::ID.graphql_definition, T.untyped)
VERSION = T.let("1.10.0.pre1", T.untyped)
INT_TYPE = T.let(GraphQL::Types::Int.graphql_definition, T.untyped)
FLOAT_TYPE = T.let(GraphQL::Types::Float.graphql_definition, T.untyped)
STRING_TYPE = T.let(GraphQL::Types::String.graphql_definition, T.untyped)
BOOLEAN_TYPE = T.let(GraphQL::Types::Boolean.graphql_definition, T.untyped)
@connorshea
connorshea / SMARTY2_BC_NOTES
Created October 8, 2019 19:09
Smarty Backwards Compatibility Notes since the official source of these notes now 404s.
= Known incompatibilities with Smarty 2 =
== Syntax ==
Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported
by a wrapper but deprecated. See the README that comes with Smarty 3 for more
information.
The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
to apply a modifier to an array instead of the individual elements. Normally you
@connorshea
connorshea / yard_trimmer.rb
Last active September 20, 2019 23:38
A simple little script to make it easier to add YARD docs for a Faker class.
# A simple little script to make it easier to add YARD docs for a Faker class.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activesupport', '~> 6.0.0'
gem 'tty-prompt'
end
require 'open-uri'
@connorshea
connorshea / flamegraph.svg
Created September 16, 2019 03:17
Flamegraph for generating sorbet-rails model RBIs with a custom plugin
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@connorshea
connorshea / 1before.log
Created September 8, 2019 03:00
Rails' logging for booting the server and loading the homepage in my browser, before and after using a logger that makes ActiveStorage shut up
=> Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.1.0 (ruby 2.6.3-p62), codename: Fourth and One
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2019-09-07 21:00:03 -0600
@connorshea
connorshea / cursed.rb
Created August 2, 2019 00:27
`User::GeneratedAttributeMethods` methods in `hidden.rbi` on Rails 6
module User::GeneratedAttributeMethods
def bio(); end
def bio=(value); end
def bio?(*args); end
def bio_before_last_save(*args); end
def bio_before_type_cast(*args); end
Connors-MacBook-Pro:vglist connorshea$ bundle exec rspec spec/requests/platforms_spec.rb
Randomized with seed 42292
1) Platforms GET platform_path returns http success for platform that has everything
Failure/Error: sig { params(user: T.nilable(User), platform: T.nilable(Platform::Relation)).void }
ActionView::Template::Error:
uninitialized constant Platform::Relation
# ./app/policies/platform_policy.rb:10:in `block in <class:PlatformPolicy>'