Skip to content

Instantly share code, notes, and snippets.

John Cipriano johncip

Block or report user

Report or block johncip

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
johncip /
Last active Dec 7, 2019
Moving from Phaser 2 to 3

Moving from Phaser 2 → 3: an incomplete guide


  • I found that the best thing was to ask myself what this or that line was meant to accomplish, and then to search for a Phaser 3 example of that task.
  • Usually the issue is just that a function has moved, or some property now requires a setter.
  • There's a real migration guide here: part 1, part 2

Scenes have replaced states (and the game object… mostly)

johncip /
Last active Jun 22, 2019
Active Record eager loading strategies

N+1 query problem

  • ORMs make it easy to a query per loop iteration, which we want to avoid


  • single query (left outer join)
  • can reference the other table's columns in where


  • a few queries (one per table)
  • typically faster
View rubocop-rspec.txt
## Formatting
* describe_class - argument to 1st `describe` should be a constant
* describe_method - 2nd argument to 1st `describe` should be a method name
* describe_symbol - don't describe a symbol
* described_class - use `described_class` over restating class name
* empty_example_group - no empty example groups
* empty_line_after_final_let - empty line after last `let`
* empty_line_after_subject - empty line after last `subject`
* example_wording - do not use "should" or "it"
View pronto_hack.rb
vi /usr/local/lib/ruby/gems/2.3.0/gems/pronto-0.8.2/lib/pronto/formatter/text_formatter.rb
# change line 17 to ...
# "[#{message.runner.title}] #{format_location(message)} #{format_level(message)}: #{message.msg}".strip
pronto run -r reek
Running Pronto::Reek
[reek] app/decorators/course_membership_decorator.rb:21 I: Is controlled by argument 'current_user' (ControlParameter)
johncip /
Last active May 26, 2016
Install VirtualBox Guest Additions on Ubuntu
# Install VirtualBox guest additions on Ubuntu
wget "$VB_VERSION/VBoxGuestAdditions_$VB_VERSION.iso"
sudo mkdir /media/VBoxGuestAdditions
sudo mount -o loop,ro "VBoxGuestAdditions_$VB_VERSION.iso" /media/VBoxGuestAdditions
sudo sh /media/VBoxGuestAdditions/
rm "VBoxGuestAdditions_$VB_VERSION.iso"
johncip /
Last active Apr 22, 2016
Browserify 3rd-party React components found on npm
# Browserify 3rd-party React components found on npm
# (prevents React & ReactDOM from being bundled)
export PACKAGE='simple-react-modal' # npm package
export EXPORT_NAME='SimpleReactModal' # will end up on window with this name
mkdir project && cd project
npm init -f
npm install -D browserify react react-dom
johncip / table_with_fixed_header.sass
Last active Apr 21, 2016
Pure-CSS fixed table headers
View table_with_fixed_header.sass
table-layout: fixed
border-collapse: collapse
thead tr
display: block
position: relative
display: block
overflow: auto
width: 100%
View viewer_components.opml
<?xml version="1.0"?>
<opml version="2.0">
<outline text="div#assignment-submission-app" >
<outline text="(modals)" />
<outline text="&lt;b&gt;AssignmentSubmissionViewer&lt;/b&gt;" _note="&lt;b&gt;div#assignment-submission-show&lt;/b&gt;" >
<outline text="PageViewerContainer" _note="div#assignment-submission-viewer&#10;(merge with child if possible)" >
johncip /
Last active Feb 17, 2016
Count on Cantor
* 264 - Count on Cantor
* Given an input value N, print the Nth term in Cantor's enumeration.
* There may be a simpler closed form of this. However, what strikes me as
* possible right now is: we figure out what diagonal n is on, which gives us
* the beginning of that diagonal (1/2, 3/1, 1/4, 5/1, etc.). Then, we adjust
* the numerator and denominator based on the distance from the first term in
* the diagonal and the direction it takes (up-right for odd, down-left for
johncip / print_fixtures.rb
Last active Feb 17, 2016
Print fixtures used
View print_fixtures.rb
log =
ActiveRecord::Base.logger =
Gradescope::Application.config.colorize_logging = false
RSpec.configure do |config|
config.after :suite do
lines = log.tap(&:rewind).readlines.to_a
matching = do |line|
next unless line =~ /Load/
You can’t perform that action at this time.