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
{"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"}} | |
]} |
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
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, |
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
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; |
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
SC.PoolableClass = { | |
isPooled: YES, | |
_objectPool: [], | |
maxPoolSize: 100, | |
_pool_default_concat_values: {}, // default values for concatenated properties | |
create: function() { | |
// first, check pool |
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
# 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 |
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
{ | |
"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" | |
} | |
} |
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
require 'couchrest' | |
class Log < CouchRest::ExtendedDocument | |
database = CouchRest.new | |
database.default_database = "logger" | |
use_database database.default_database | |
property :response_time | |
property :created_at |
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
<% if can? :destroy, @comment %> | |
<%= link_to 'Delete', comment_path({:id => comment.id}), :confirm => "Are you sure?", :method => :delete %> | |
<% end %> |
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
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 |
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 BaseModel < CouchRest::ExtendedDocument | |
include ActiveModel::Dirty | |
use_database DB | |
def initialize(passed_keys={}, options={}) | |
super(passed_keys, options) | |
@changed_attributes = {} | |
end | |
class <<self |
OlderNewer