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
ops = | |
"=": (l,r) -> l is r | |
">": (l,r) -> l > r | |
"<": (l,r) -> l < r | |
">=": (l,r) -> l >= r | |
"<=": (l,r) -> l <= r | |
"<>": (l,r) -> l <> r | |
"is null": (l) -> l is null | |
"is not null": (l) -> l is not null | |
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 sort? and (sort.get "items").length > 0 | |
parts = for item in (sort.get "items") | |
dir = if item[0] == "-"? then "DESC" else "ASC" | |
"#{ if dir == "ASC" then item else item.slice 1 } #{ dir }" | |
sql += " ORDER BY #{ parts.join ", " }" |
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
@asyncIt = (desc, test) -> | |
spec = jasmine.getEnv().it desc | |
__spy = new sinon.spy | |
__done = no | |
_NATIVE_ERR = window.onerror | |
spec.runs -> | |
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
body { | |
background: #808080; | |
background: #333333; | |
background: #b3b3b3; | |
background: #2b2b2b; | |
} |
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
@withAppIt = (desc, test) -> | |
spec = jasmine.getEnv().it desc | |
__app = null | |
__spy = new sinon.spy | |
__done = no | |
_NATIVE_ERR = window.onerror | |
# Perform the regular cleanup after a TestApplication test gets run. Restore | |
# ajax, and reset the DB. |
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
package com.thurloat.foo; | |
import org.codehaus.jackson.annotate.JsonIgnore; | |
import org.codehaus.jackson.annotate.JsonProperty; | |
/** | |
* In order to write a composite data property (stats) out to JSON without reading | |
* it back in, you need to explicitly ignore the property, as well as the setter and | |
* then apply the @JsonProperty annotation to the getter. | |
**/ |
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 @SyncView | |
for season in ["spring", "summer", "fall", "winter"] | |
for field in ["title", "story"] | |
fieldPropertyName = season + field.charAt(0).toUpperCase() + field.substr(1) | |
pName = "#{ fieldPropertyName }ToModel" | |
TrendFormView.prototype[pName] = _.bind (s, f) -> | |
@seasonFieldToModel s, f | |
, TrendFormView.prototype, season, field |
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
var ViewFactory = (function() { | |
function ViewFactory(pubSub) { | |
this.pubSub = pubSub; | |
this.registry = {}; | |
this.registry['factory'] = this; | |
} | |
ViewFactory.prototype.register = function(key, value) { | |
return this.registry[key] = value; |
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
qs = (arr) -> | |
[].concat qs(i for i in arr when i < arr[0]), [arr[0]], qs(i for i in arr when i > arr[0]) if arr.length <= 1 else arr |
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 of your views should inherit from the BaseView. As a result you get the | |
# globalEvents functionality for free. The globalEvents hash is similar to that | |
# of the built-in Backbone events hash. It automatically binds event names to | |
# instance methods. | |
# | |
# class TestView extends ModularView | |
# | |
# globalEvents: | |
# "PhoneRang": "answerPhone" | |
# |