Skip to content

Instantly share code, notes, and snippets.

View matthewrudy's full-sized avatar

Matthew Rudy Jacobs matthewrudy

View GitHub Profile
@matthewrudy
matthewrudy / floppy.rb
Created February 12, 2010 03:38 — forked from pjb3/floppy.rb
class Floppy
def metaclass
class << self
return self
end
end
def metaclass_eval(&block)
metaclass.class_eval(&block)
@matthewrudy
matthewrudy / benchmark.rb
Created March 21, 2012 09:08 — forked from dentedtriangle/benchmark.rb
Testing the <23 string issue
require 'benchmark'
ITERATIONS = 1000000
Benchmark.bm(10) do |bench|
0.upto(40) do |n|
bench.report("chars: #{n}") do
string = "n"*n
ITERATIONS.times do
string + 'x'
def get_course
if params[:course] && course_id = params[:course][:id]
Course.find_by_id(course_id)
end
end
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
apps = {}
`heroku list`.split("\n").each do |app|
app = app.strip
@matthewrudy
matthewrudy / md.md
Last active December 28, 2015 05:29 — forked from godfat/md.md

I am aware that they are slightly different, but I am too lazy to make the one in ActiveRecord do the same thing as Sequel. In general it seems Sequel would take the advantage of subqueries, but ActiveRecord might not.

In this case, it seems Sequel's SQL is faster than the one generated by ActiveRecord.

Sequel model:

class User < Sequel::Model(Sequel.connect(DATABASE_CONFIG))
  one_to_many :issues, :class => class_name(:Question),
    :dataset => lambda{
#include <EEPROM.h>
#include <LiquidCrystal.h>
const int counterAddr = 0;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);