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
https://wormhole.app/MBKn6#nztdHM323zzWZ5Iapf1u3g
ANIME_SPECIFIC_PROPERTIES = [
'P1811', # list of episodes
'P1113', # number of episodes
'P364', # original language of film or TV show
'P449', # original broadcaster
'P2047', # duration
'P86', # composer
'P57', # director
@connorshea
connorshea / gdq-parser-helper.rb
Last active July 2, 2022 18:45
Proof-of-concept script that scrapes the GDQ schedule page and then pulls the vglist and IGDB IDs from the vglist API. This'd then be used to pull cover data and such from IGDB. It doesn't get every game in the schedule, but it can get most of them automatically, which will reduce the amount of manual effort involved in setting up the data for a…
require 'json'
gdq_schedule = JSON.parse(File.read('gdq.json'))
total_entries = gdq_schedule.count
puts "Total entries: #{total_entries}"
game_only_entries = gdq_schedule.filter { |entry| !entry['non_game'] }.count
puts "Game-only entries: #{game_only_entries}"
entries_with_vglist_ids = gdq_schedule.filter { |entry| !entry['vglist_id'].nil? }.count
puts "Entries with vglist IDs: #{entries_with_vglist_ids} (#{(entries_with_vglist_ids.fdiv(game_only_entries) * 100).round(2)}%)"
@connorshea
connorshea / sorbet-rails-check.svg
Created July 5, 2021 19:18
TypedObject#name with typechecking vs without typechecking. For a PR that improves the performance of Parlour
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@connorshea
connorshea / README.md
Last active July 5, 2020 19:28
JSON array of games on vglist that have a Wikidata ID but the Wikidata item has no vglist ID property.

JSON array of games on vglist that have a Wikidata ID but the Wikidata item has no vglist ID property. These aren't added automatically because the names on vglist and Wikidata differ. Someone should go through each of these (possibly with a simple script that'll automatically open each item in your browser) and let you decide whether they match, but not me because I'm lazy.

@connorshea
connorshea / activestorage_with_custom_logger.log
Created May 11, 2020 01:39
Rails' logs when loading a page with 15 images, comparison between the default logger and a custom logger.
=> Booting Puma
=> Rails 6.0.3 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.3 (ruby 2.6.5-p114), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
Use Ctrl-C to stop
@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 / 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).