Skip to content

Instantly share code, notes, and snippets.

View milesmatthias's full-sized avatar

Miles Matthias milesmatthias

View GitHub Profile
@milesmatthias
milesmatthias / a.rb
Created May 16, 2014 20:10 — forked from ahoward/a.rb
# make this script run, update your gist with the running script, and it's
# output in a separate gist. the entire quzi should take 1-3 minutes, but you
# get 5.
#
# the meat - take < 5 minutes to do this
#
assert :hash do
x = {}
@milesmatthias
milesmatthias / a.md
Last active January 2, 2016 09:58 — forked from ahoward/a.md

recently our team had an exchange about lazy evaluation of ORM queries in ruby ( https://gist.github.com/ahoward/8285529 ) - this prompted me to think about how deep rails has really become and just how hard good MVC organization for the web really is. back in the day it took a special kind of developer to understand how to not kill a db when it was used in a web app - now it's pretty easy and, while this seems good on the outside, in the inside i think today's developers understand less and less about why web programming is really the hardest kind there is.

that's the motivation for today's quiz. to take it fork and keep your answer under 142 LOC total

given a model, Post, write code which will

  • load the 2nd set of 5 results (page 2 of 5 each)
  • access them in the view
@milesmatthias
milesmatthias / action.rb
Last active December 20, 2015 18:19 — forked from ahoward/action.rb
# it's not critical for understanding
# but here is the associated server-side action
#
def version
@program = load_program!
@version = @program.versions.find(params[:version_id])
if stale?(:last_modified => @version.updated_at, :etag => @version.cache_key)
render