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
/** | |
@property | |
This is the actual array of records in the current collection. This | |
property will change anytime the record members change (but not when | |
the member record properties change). | |
@type {Array} | |
*/ | |
records: function() { |
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
// .......................................... | |
// REFRESH | |
refreshRecords: function(records, options) { | |
if (!records || records.length == 0) return ; | |
if (!options) options = {} ; | |
records = records.byResourceURL() ; // group by resource. | |
for(var resource in records) { | |
if (resource == '*') continue ; |
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
def self.first_uninteresting | |
last = 0 | |
Number.all(:order => "number").each do |n| # Number.find/all will return an enumerable, so you can each it directly. | |
return last + 1 if n.number.to_i != last + 1 # if's can be on the same line at the end for basic tests | |
last = n.number.to_i #ops forgot the number casting | |
end | |
last + 1 # Ruby will automatically return the last valuation, no need for 'return' | |
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
#Ruby assignment option to assign unless nil | |
replacement_content = page_contents.content_label_find(item) | |
element.inner_html = replacement_content if replacement_content | |
# Should be able to do something like... not sure if the "=||" is the best suggestion for the assignment symbols | |
element.inner_html =|| page_contents.content_label_find(item) | |
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
compareObjects: function (v1, v2) { | |
var orderDefinition = [SC.T_ERROR, SC.T_UNDEFINED, SC.T_NULL, SC.T_BOOL, SC.T_NUMBER, SC.T_STRING, SC.T_ARRAY, SC.T_HASH, SC.T_OBJECT, SC.T_FUNCTION, SC.T_CLASS]; | |
//function getType (v) { | |
// var t = typeof v; | |
// if (t == 'object') { | |
// if (t == null) return 'null'; | |
// if (t instanceof Array) return 'array'; | |
// } |
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
Sprout Casts: | |
All of these are focused on 1.0 | |
- Make a blank app. | |
- setting up a model | |
- with some fixtures. | |
- Setup some views (a list, with a form) |
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 ActiveRecord | |
module NamedScope | |
class Scope | |
def conditions | |
@conditions ||= begin | |
all_conditions = [] | |
scope = self | |
while scope.class == self.class | |
all_conditions << scope.proxy_options[:conditions] | |
scope = scope.proxy_scope |
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
frameworks/sproutcore/frameworks/foundation/views/view.js: line 1371 | |
/** | |
The layout describes how you want your view to be positions on the | |
screen. You can define the following properties: | |
- left: the left edge | |
- top: the top edge | |
- right: the right edge | |
- bottom: the bottom edge |
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
layoutView : SC.SplitView.design({ | |
layoutDirection: SC.LAYOUT_HORIZONTAL, | |
defaultThickness: 200, | |
layout: {bottom:0, top:0, left:0, right:0}, | |
canCollapseViews: NO, | |
// the left view... | |
topLeftView: SC.SplitView.design({ | |
layoutDirection : SC.LAYOUT_VERTICAL, | |
defaultThickness: 200, | |
layout: {bottom:0, top:0, left:0, right:0}, |
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
firstName: SC.Record.attr(String), | |
lastName: SC.Record.attr(String), | |
fullName: function(key, newValue) | |
{ | |
if(newValue) { | |
var names = newValue.split(" "); | |
this.set('firstName', names[0]); | |
this.set('lastName', names[1]); | |
return this; |
OlderNewer