Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created March 11, 2010 16:22
Show Gist options
  • Save jhsu/329296 to your computer and use it in GitHub Desktop.
Save jhsu/329296 to your computer and use it in GitHub Desktop.

Mountain West Ruby Conference 2010 - notes

Archaeopteryx: Lambdas In Detail by Giles Bowkett

midi - like json

on / off which note

gem install midilib
gem install midiator

achaeopteryx

lambda - evals on call

foo.bar = lambda { return "bar" }
foo.bar[]

Google PageRank

  • inject, probability matrix (associating things w/ probability)
  • pages == inbound_links
  • probability distribution
  • probability matrix (5 lines)
  • python, where's the dick jokes?

Spell checking (in python)

Rock Papper Scissors

Prediction using Bayes' theorem

P = F/T

Probabilistic Reasoning in Internet Systems by Judea Pearl

Probability of Raining

Music

using Reason

drum machine - t/f

drum probability hash, array of floats

midi

note number - the sample note number

the float - ceiling (red/green light gate)

midi patch bay

awesome live music

lambda involvement

Rack by Michael Jackson

lots ways to make apps, lots ways to serve apps

The Spec

  1. env - hash (cgi-like headers, rack-specific vars)
  2. Apps - object that responds to #call
  3. Response - #=> [status, headers, body]

Middleware

calls #call(app) and returns response so wrapper can use the response

Rack::Builder.[use, map, run]

#to_app (rack url map)

Rack::Handler::WEBrick.run app

rackup

uses Rack::Builder

Routing

Which app to run? Like Sinatral DSL

Mohr rack goodness

Rack::Lint & Rack::ShowExceptions
racksh
Rack::Bug
Rack::Debug
rack/lib
rack-contrib

mwrc2010 Rack presentation

Modularity by Matz

app -> requirements vs requirements -> app

basic plan -> (app -> modularity) x N

Dynamism

alias_method_chain

Modularity

modularity - reduce assumption to increase reuse

reuse case exists?

Constants, global vars

include application.routes.route_helpers

Don't hardcode, store things in global

class_attribute :perform_caching

Render in rails3

Controller -> ViewPathSet -> ViewPath -> Template

HTTP by Paul Sadauskas

github.com/paul

History

Features HTTP/1.1

  • persistent connections - prevent recreating/deconstructing tcp connections

Caching

  • User Agent
  • Origin Server
  • Caching Proxy

expires - datetime something is stale after

response.headers['Expires']

max-age - number of seconds something should live

Validation

last-modified / if-modified-since

e-tag / if-none-match

fresh_when

last_modified = Somrero.max(:updated_at)
if stale?(:last_modified -> last_modified)
  ...
end

Vary header - except header

Cache-Control: public, private(intermediate should not cache), no-cache, no-store

REST

guidelines for using HTTP

HATEOAS - Hypertext As The Engine Of Application State

Sessions - cookies for AUTH? Vary on the cookie, cache is less effective

Ruport

... Who turned off the lights? =_=;;

Code for Art2

ruby-processing

def setup; end # runs once

def draw
  background 255
  fill rand(255), rand(255), rand(255)
  save "something.png"
  exit
end # loops until exit

18mb gem...

rp5 ... ...

using beanstalkd to queue jobs to generate images

video processing, tag video

using efficient workers to distribute: 2d images, 3d images, audio & video

Ruby 124c41+ by Matz

Book by Hugo Gernsback

100M connection in Japan

Better hardware

Software trend

Dec 21, 1995 - Ruby public release version 0.95

Extreme Language Design - if something is good, use everywhere (all or none)

mixins are good, only allow single inheritence

Faster

  • dRuby / Rinda
  • Message Queue
  • multi-core

Broader

  • small -> embedding - smaller implementation (alternative?), atomic ruby

High Performance Computing (HPC)

  • improve NArray (/w libjit)
  • MPI Ruby
  • AOT Compiler

Future

  • more modular
  • Selector Namespace - limit the effectiveness of name overriding
  • scoped mathn, for example
  • more functional

Traits - operational combination of features (methods) (module operation +,-)

Ruby Macros

defmacro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment