Skip to content

Instantly share code, notes, and snippets.

@model.comments.fetch
success: =>
commentListView = new CommentListView
collection: @model.comments
fetchOnInit: false
title: 'All comments'
$(@el).append commentListView.render().el
def within_box_or_near(location_class, box, center)
box.present? ? location_class.within_box(box) : location_class.near(center)
end
def filter(params)
locations = {}
within_box_or_near(Location.class_for_provider(services.shift), @box, @center).each do |location|
locations[location.loc_hash] = location
# Uses 101 (also known as n + 1 where n = 100) queries
mergeTransactionsBad: ->
all_transactions = []
te_transactions = db.run "select * from te_transactions where member_id=1 order by posted_at DESC limit 100"
for transaction in te_transactions
network_transaction = db.run "select * from network_transactions where transaction_id=#{transaction.id}"
transaction.member_id = network_transaction.id
{ styles } = require 'helpers'
PayoffOverview = require 'views/accounts/payoff/overview'
module.exports = class PayoffWindow extends Backbone.TitaniumView
viewName: 'Window'
attributes: styles.window.main
styles = require('styles').ui
KitchenSink = require './main'
{ Button, Window } = require 'views/ui'
module.exports = class IntroView extends Window
render: =>
styles = require('styles').ui
{ Button, Window } = require 'views/ui'
module.exports = class IntroView extends Window
render: =>
@layout (view) =>
styles = require('styles').ui
{ Button, ContentBlock, Window } = require 'views/ui'
module.exports = class IntroView extends Window
render: =>
@layout (view) =>
@trabianmatt
trabianmatt / packages.txt
Created July 2, 2012 05:10
Matt's packages installed so far
* Case Conversion
* Backbone - Trabian (custom plugin)
* ChangeQuotes
* CoffeeScript
* CTags (with coffeescript ctags)
* Git
* GitHubinator
* Guard (prevents need to keep a separate terminal open for running guard)
* Jade
* Origami
@trabianmatt
trabianmatt / delegated_event_example.coffee
Last active December 10, 2015 13:49
Example delegated event
class ExtendedView extends View
clicked: false
events:
'click #someChild': 'clickMethod'
render: =>
Backbone.$('<View>')
@trabianmatt
trabianmatt / titanium-backbone-api-example.coffee
Created January 4, 2013 16:14
Example usage of titanium-backbone
# Default Titanium API
button = Ti.UI.createButton
title: 'Testing'
button.addEventListener 'click', ->
alert 'Click!'
return
@view.add button