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 / 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
Loading
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>'
@connorshea
connorshea / renew-gpg-key.md
Last active January 26, 2022 18:03
Renewing your GPG Key

See here: https://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/

  • Need to figure out your key ID (check the recent commits you've made on GitHub, probably? Or use gpg --list-secret-keys --keyid-format LONG)
  • gpg --edit-key ID_GOES_HERE
  • expire
  • Set the expiration to whenever (1 year is probably fine)
  • save
  • Check gpg --list-keys and gpg --list-secret-keys to make sure the keys now have updated dates.
  • Delete the existing key (for work, you probably only have the one that's associated to your work email) in your GitHub GPG settings and re-generate a public key with gpg --armor --export KEY_ID_HERE. (If you try to upload the newly-renewed key without deleting the old key, GitHub won't let you upload it.)
  • Use that new public key to create a new key in GitHub's GPG settings.
@connorshea
connorshea / tasks.jsonc
Created April 20, 2019 01:18
VS Code `tasks.json` file for DragonRuby Game Toolkit, drop it in `.vscode/tasks.json` in the dragonruby folder and then open the Command Palette (Ctrl/Cmd + Shift + P), choose "Run task", and then choose your task :) Should work on macOS and Linux, not sure about Windows.
{
// tasks.json for dragonruby samples
"version": "2.0.0",
"tasks": [
{
"label": "doomwipe",
"type": "shell",
"command": "./dragonruby samples/doomwipe/",
"problemMatcher": []
},
@connorshea
connorshea / vscode-extension-idea.md
Last active April 25, 2019 20:59
An idea for a 'Learn X in Y Minutes' extension.

Make a VS Code extension that displays content from Learn X in Y Minutes.

I imagine this'd work as follows:

  • Open the Command Palette
  • Run the command 'Show example from Learn X in Y Minutes'
  • Pick a page from the list of options (Essentially just the page names, Ruby, Go, PHP, Python, etc.)
  • The extension opens a view that displays the formatted Markdown. (Use VS Code's built-in Markdown renderer to render the Markdown.)

The extension would only support English to start with, I guess. I'm not sure if it'd be sufficient to download the markdown file from the Learn X in Y Minutes repo on-demand or if it'd be better to bundle it in the extension. The license for LXIYM is CC-BY-SA so credit needs be given, obviously.