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
| var query = SC.Query.local(MyApp.Record); | |
| var data = MyApp.store.find(query); | |
| // old way | |
| var f = function() { | |
| if (data.get('status') & SC.Record.READY) { | |
| data.removeObserver('status', this, f); | |
| // ... | |
| } | |
| }; |
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
| // apps/test/controllers/display.js | |
| Test.displayController = SC.ObjectController.extend({ | |
| nowShowing: 'Test.mainPage.displayView', | |
| showDisplayView: function() { | |
| this.set('nowShowing', 'Test.mainPage.displayView'); | |
| }, | |
| showCodeView: 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
| addFiniteObserver: function(key, target, method, context){ | |
| // normalize. if a function is passed to target, make it the method. | |
| if (method === undefined) { | |
| method = target; target = this ; | |
| } | |
| if (!target) target = this ; | |
| if (typeof method === "string") method = target[method] ; | |
| if (!method) throw "You must pass a method to addObserver()" ; |
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
| // setting up an observer | |
| var query = SC.Query.local(MyApp.Record); | |
| var data = MyApp.store.find(query); | |
| var f = function(data) { | |
| if (data.get('status') & SC.Record.READY) { | |
| // data is ready | |
| return YES; | |
| } |
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
| volumeCount: SC.FormView.row(SC.LabelView, { | |
| layout: {height: 18, width: 50}, | |
| label: 'RANDOM' | |
| }) | |
| // this gets passed through to: | |
| row: function(label, fieldType, ext) | |
| { | |
| if (label.isClass) { | |
| ext = fieldType; |
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
| project/ | |
| apps/ | |
| project/ | |
| Buildfile | |
| frameworks/ | |
| table/ | |
| config :all, :required => ['sproutcore', 'table'] |
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
| var stagger = 0; | |
| var top = 25; | |
| layer.append('<div class="markingLabel" style="width:125px;height:auto;position:absolute;left:' + Number(offset.left - 62.5) + 'px;top:' + Number(top+stagger) + 'px;color:#000000;">'+label+'</div>'); |
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
| MyApp.MyObject = SC.Object.extend({ | |
| property: value; | |
| computedProperty: function(){ | |
| return this.get('property') === "foo"; | |
| }.property('property'), | |
| setProperty: function(value){ | |
| this.set('property',value); |
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
| extend: function(ext) { | |
| var ret = SC.mixin(SC.beget(this), ext), | |
| key, value, cur; | |
| for(key in ret) { | |
| value = ret[key]; | |
| if (value instanceof Function && !value.superclass && (value !== (cur=this[key]))) { | |
| value.superclass = value.base = cur; | |
| } | |
| } |
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
| lessed.each_line {|line| | |
| final += line.gsub(/url\('data:image\/(gif|png);base64,(.*?)'\)/) do |match| | |
| "url('data:image/" + $1 + ";base64," + $2.gsub(" ", "+") + "')" | |
| end | |
| } |