Skip to content

Instantly share code, notes, and snippets.

{"total_rows":2,"offset":0,"rows":[
{"id":"1","key":"14-NB","value":{"id":"1","partNumber":"1234-567","description":"Line 1, Line2","brand":"3M","stockNumber":"14-NB"}},
{"id":"2","key":"999-9999","value":{"id":"2","partNumber":"13-NB","description":"Description Line 1, Line 2","brand":"3M","stockNumber":"999-9999"}}
]}
Superduper.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
backgroundColor: '#ddd',
childViews: 'topBar body bottomBar'.w(),
topBar: SC.ToolbarView.design({
layout: { top: 0, left: 0, right: 0, height: 40 },
backgroundColor: '#4c4c4c',
borderStyle: SC.BORDER_NONE,
planBuildingViewsDidChange: function() {
var planBuildingViews = SC.A(this.get("planBuildingViews")),
showResearch = (planBuildingViews.indexOf("siteResearch") > -1),
showPlanning = (planBuildingViews.indexOf("planning") > -1),
splitView = Research.mainPage.planBuilding,
research = splitView.topLeftView,
planning = splitView.bottomRightView,
divider = splitView.dividerView,
dividerThickness = splitView.dividerThickness,
totalHeight = splitView.get("frame").height;
SC.PoolableClass = {
isPooled: YES,
_objectPool: [],
maxPoolSize: 100,
_pool_default_concat_values: {}, // default values for concatenated properties
create: function() {
// first, check pool
# Installing Rails 3.0.pre in it's own gemset using rvm.
# I use Ruby Enterprise Edition for rails development.
# You might want to replace ree with Your Favorite Ruby Implementation(tm)
rvm use ree%rails3 # Create new gemset called rails3.
gem install rake rack test-spec thor sqlite3-ruby # Get some gems we'll need (rails3 gemset should be empty)
git clone git://github.com/rails/rails.git && cd rails # Get rails source.
git submodule init && git submodule update # Get git dependencies.
rake package && gem install -f */pkg/*.gem pkg/*.gem # Create gems and install
cd arel && thor :build && thor :install && cd ../.. # Install arel
{
"all": {
"map": "function(doc) {\n if (doc['couchrest-type'] == 'BlogUser') {\n emit(doc['_id'],1);\n }\n }"
},
"by_account": {
"map": "function(doc) {\n if ((doc['couchrest-type'] == 'BlogUser') && doc['account']) {\n emit(doc['account'], null);\n }\n}\n"
}
}
require 'couchrest'
class Log < CouchRest::ExtendedDocument
database = CouchRest.new
database.default_database = "logger"
use_database database.default_database
property :response_time
property :created_at
<% if can? :destroy, @comment %>
<%= link_to 'Delete', comment_path({:id => comment.id}), :confirm => "Are you sure?", :method => :delete %>
<% end %>
require "rubygems"
require "faker"
require "couchrest"
DB = CouchRest.database!('http://127.0.0.1:5984/contacts')
class Contact < CouchRest::ExtendedDocument
use_database DB
property :first_name
class BaseModel < CouchRest::ExtendedDocument
include ActiveModel::Dirty
use_database DB
def initialize(passed_keys={}, options={})
super(passed_keys, options)
@changed_attributes = {}
end
class <<self