This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VIN | |
WMI = { | |
'10T' => {:name =>'Oshkosh'}, | |
'11V' => {:name =>'Ottawa'}, | |
'137' => {:name =>'Hummer'}, | |
'15G' => {:name =>'Gillig'}, | |
'17N' => {:name =>'John Deere'}, | |
'16V' => {:name => 'Bix Tex'}, | |
'18X' => {:name =>'WRV'}, | |
'19U' => {:name =>'Acura'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/rabl.rb | |
# monkey patch to format date automatically | |
module Rabl | |
class Configuration | |
attr_accessor :force_iso_dates | |
end | |
class Builder | |
def to_hash(object = nil, settings = {}, options = {}) | |
@_object = object if object | |
@options.merge!(options) if options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# gem 'merb', :path => '../merb/merb' | |
gem 'merb-gen', :path => '../merb/merb-gen' | |
gem 'merb-core', :path => '../merb/merb-core' | |
gem 'merb-haml', :path => '../merb/merb-haml' | |
gem 'merb-action-args', :path => '../merb/merb-action-args' | |
gem 'merb-assets', :path => '../merb/merb-assets' | |
gem 'merb-cache', :path => '../merb/merb-cache' | |
gem 'merb-exceptions', :path => '../merb/merb-exceptions' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
git 'https://github.com/astevens/merb.git', :branch => 'active_support' do | |
# gem 'merb' | |
gem 'merb-gen' | |
gem 'merb-core' | |
gem 'merb-haml' | |
gem 'merb-action-args' | |
gem 'merb-assets' | |
gem 'merb-cache' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rest-firebase' | |
f = RestFirebase.new :site => 'https://hacker-news.firebaseio.com', | |
:log_method => method(:puts), | |
:auth => false | |
@top_stories = [] | |
topstories_service = f.event_source('v0/topstories').onmessage do |event, data| | |
puts "Recived #{event}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# author: Konstantin Gredeskoul © 2008 | |
# license: public domain | |
# | |
require 'net/http' | |
require 'uri' | |
module KBB | |
MODELS_URL = "http://scripts.kbb.com/kbb/ymmData.axd?VehicleClass=UsedCar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this hack works around inline c libs that return false in successfull load | |
class Inline::C | |
def load | |
require "#{so_name}" | |
#below is the original version which breaks | |
#require "#{so_name}" or raise LoadError, "require on #{so_name} failed" | |
end | |
end | |
# now we are ready to load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Merb::Helpers::Form::Builder | |
class Base | |
private | |
def options_for(attrs) | |
blank, prompt = attrs.delete(:include_blank), attrs.delete(:prompt) | |
b = blank || prompt ? tag(:option, prompt || "", :value => "") : "" | |
# yank out the options attrs | |
collection = attrs.delete(:collection) | |
selected = attrs.delete(:selected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mongoid | |
module Extensions | |
module Object | |
module Reflections | |
extend ActiveSupport::Concern | |
alias :invar :ivar | |
undef :ivar | |
def invar(name) | |
if instance_variable_defined?("@#{name}") | |
return instance_variable_get("@#{name}") |