This file contains hidden or 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
| require 'rubygems' | |
| require 'couchrest' | |
| require 'freedb_reader' | |
| require 'json' | |
| @db = CouchRest.database!("http://127.0.0.1:5984/cd") | |
| freedb_path = 'freedb-complete-20090801.tar/' |
This file contains hidden or 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
| require 'rubygems' | |
| require 'couchrest' | |
| require 'freedb_reader' | |
| require 'json' | |
| @db = CouchRest.database!("http://127.0.0.1:5984/cd") | |
| freedb_path = 'freedb-complete-20090801.tar/' | |
| dirs = Dir.entries(freedb_path).delete_if{|x| x.include?(".")} | |
| dirs.each do |d| | |
| Dir.entries(freedb_path+d).delete_if{|x| x.include?(".")}.each do |file| |
This file contains hidden or 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
| { | |
| "artist": "Black Crowes, The", | |
| "title": "Shake Your Money Maker", | |
| "disc_id": "860a950b,890a950b,910a940b", | |
| "year": "1990", | |
| "genre": "Rock", | |
| "tracks": [ | |
| "Twice As Hard", | |
| "Jealous Again", | |
| "Sister Luck", |
This file contains hidden or 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
| require 'rubygems' | |
| require 'mongomapper' | |
| require 'freedb_reader' | |
| MongoMapper.connection = XGen::Mongo::Driver::Mongo.new('localhost') | |
| MongoMapper.database = 'cd' | |
| class Cd | |
| include MongoMapper::Document |
This file contains hidden or 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
| require 'rubygems' | |
| require 'freedb_reader' | |
| require 'rufus/tokyo' | |
| t = Rufus::Tokyo::Table.new('table.tct') | |
| freedb_path = 'freedb-complete-20090801.tar/' | |
| i = 0 | |
| dirs = Dir.entries(freedb_path).delete_if{|x| x.include?(".")} | |
| dirs.each do |d| | |
| Dir.entries(freedb_path+d).delete_if{|x| x.include?(".")}.each do |file| |
This file contains hidden or 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 Deal | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name_key, String | |
| property :dealer, String | |
| property :name, Text | |
| property :link, Text | |
| property :price, Integer | |
| property :visible, Boolean, :default => true |
This file contains hidden or 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 ProductsController < InheritedResources::Base | |
| respond_to :html, :xml | |
| def reorder | |
| Product.save_order(params['table-products']) | |
| respond_to do |format| | |
| format.js { render 'collections/reorder' } | |
| end | |
| end | |
This file contains hidden or 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 Sortable | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
| module ClassMethods | |
| def save_order(items) | |
| items.each_with_index do |item,i| | |
| begin |
This file contains hidden or 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
| # Para salvar a altura e largura das imagens enviadas pelo plugin paperclip, utilize o callback abaixo | |
| # | |
| # class Document < ActiveRecord::Base | |
| # | |
| # has_attached_file :document, :styles => { :medium => "300x300>" } | |
| # | |
| # before_save :save_dimensions | |
| # | |
| # def save_dimensions | |
| # if document.image? |
This file contains hidden or 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
| # Be sure to restart your server when you modify this file | |
| # Specifies gem version of Rails to use when vendor/rails is not present | |
| RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION | |
| # Bootstrap the Rails environment, frameworks, and default configuration | |
| require File.join(File.dirname(__FILE__), 'boot') | |
| Rails::Initializer.run do |config| | |
| # Settings in config/environments/* take precedence over those specified here. |