Skip to content

Instantly share code, notes, and snippets.

@nilbus
nilbus / gist:740a05b9454d6794e804
Last active August 29, 2015 14:25 — forked from swalke16/gist:cbc8fd10180d9d04d682
Robot Controller Exercise

#Assignment:

Create a controller for a robot

Right
Forward
Left 0

Keybase proof

I hereby claim:

  • I am nilbus on github.
  • I am nilbus (https://keybase.io/nilbus) on keybase.
  • I have a public key whose fingerprint is 2C66 B954 C4C1 65BE 0A7D AE1B 54B8 794B A0BD E177

To claim this, I am signing this object:

@nilbus
nilbus / good-commit-messages.md
Last active August 29, 2015 14:09
Good commit messages, as an example

Good commit messages, as an example

Summarize briefly what the commit does, like an email subject

When it's not obvious, use additional paragraphs to describe /why/
you're making the change. The diff already shows /what/ the change is.

In the future if your change causes a problem or someone (you?) has to
modify it, understanding the reasoning is very helpful! Commit messages
@nilbus
nilbus / pending_migration_check.rb
Created November 4, 2014 17:08
Check if there are pending migrations without loading the Rails app, for speedy checks. Store in the script directory.
#!/usr/bin/env ruby
# Consider loading the db driver directly instead of relying on relatively slow bundler
require 'bundler'
Bundler.setup
require 'rails'
require 'active_record'
# Load the Rails configuration without loading the application
@nilbus
nilbus / Makefile
Last active October 14, 2016 08:56
GATech CS-6300 Assignment 6 Makefile
# For Linux (different sed arguments)
TEST_CLASSES := bin/edu/gatech/replace/AllTests.class bin/edu/gatech/replace/ReplaceTest.class
all: show-coverage
show-coverage: replaceCoverage/frame-summary.html
@grep % replaceCoverage/frame-summary.html | head -n 1 | sed -e 's/.*>\([0-9]\+%\).*>\([0-9]\+%\).*/\nCoverage: Line: \1, Branch: \2/'
build-tests: $(TEST_CLASSES)
@nilbus
nilbus / repositories.md
Last active August 29, 2015 13:57
Ruby method order analysis
  • aasm
  • attachment_fu
  • authlogic
  • bacon
  • bj
  • bootstrap-sass
  • bundler
  • cancancan
  • carrierwave
  • celluloid
@nilbus
nilbus / benchmark.txt
Created February 28, 2014 22:58
Multiply Arrays runs out of memory with board dimension 1,000,000
user system total real
Loop and shovel 14.310000 0.200000 14.510000 ( 14.793983)
Multiply arrays 7.220000 0.350000 7.570000 ( 7.854261)
#!/usr/bin/env ruby
class Game
def play
setup_game
get_players
@server = pick_starter
until winner
rally
determine_server
@nilbus
nilbus / java_for_rubyists.md
Last active January 25, 2023 18:49
Some Java basics for Rubyists
  1. Java uses static, declared typing:

    String hello = "Hello, World!";
    List<String> phrases = new ArrayList<String>;
    phrases.add(hello);
    phrases.add(null);
    phrases.add(123); // Compile error! Not a string.
@nilbus
nilbus / next_suitable_contestant.sql
Last active January 2, 2016 02:49
An example next_suitable_contestant query, pulled from the log
SELECT
contestants.*,
count(runs_with_chosen.id) AS heat_count_with_chosen,
count(DISTINCT heats.id) AS heat_count,
avg(runs.time) AS average_run_time
FROM "contestants"
LEFT JOIN runs ON runs.contestant_id = contestants.id
LEFT JOIN runs AS runs_in_lane ON runs.contestant_id = contestants.id AND runs.lane = 1
LEFT JOIN heats ON heats.id = runs.heat_id
LEFT JOIN runs AS runs_with_chosen ON runs_with_chosen.heat_id = heats.id AND runs_with_chosen.contestant_id IN (0)