Creating Models becomes much easier with the Base Model.
In this example I will walk through some of the default conventions and requirements for creating such a model.
Creating Models becomes much easier with the Base Model.
In this example I will walk through some of the default conventions and requirements for creating such a model.
Creating Collections becomes much easier with the Base Collection.
In this example I will walk through some of the default conventions and requirements for creating such a collection.
| #actually renders the validations | |
| #if you are using listenTo these arguments are automatically passed in | |
| renderValidations: (model, errors)-> | |
| _.each errors, (error) => | |
| $el = if error.cid then @$("[data-id=#{error.cid}]") else @$el | |
| selector = if error.nested_attr then "[data-nested-name=#{error.nested_attr}]" else "[name=#{error.name}]" | |
| #validations are namespaced by model id for removal | |
| $el.find(selector).after("<span class='#{model.cid}-validation label label-important'>#{error.errors.join(', ')}</span>") | |
| #!/bin/sh | |
| gcherry(){ | |
| if [ $1 ];then | |
| name=$1 | |
| else | |
| name="@{-1}" | |
| fi | |
| echo "cherry picking $( git reflog $name -n 1 )" | |
| git cherry-pick $( git reflog $name -n 1 | awk '{print $1}' ) |
| USAGE="Usage: csv_split file.csv (lines to be included use n..n as a range)" | |
| if [ "$#" == 0 ]; then | |
| echo "$USAGE" | |
| exit 1 | |
| fi | |
| filename=$1 | |
| shift |
| #usage _! (2 previous lines) _! 3 (3 previous lines) | |
| def _!(num = 2) | |
| line = Pry.history.to_a[-1-num] | |
| puts "evaling #{line}" | |
| unless line == '_!' or line == '_' | |
| Pry.send(:eval, line) | |
| end | |
| end |
| route -n get default | grep gateway | awk '{print $2}' |
| #should only need to be done once | |
| gem 'jasmine' | |
| gem 'guard-jasmine' | |
| gem "jasminerice", :git => 'https://github.com/bradphelan/jasminerice.git' |
| localhost:[port]/jasmine |
| #keep tabs on your vent bindings. If you dont kill them they will slowly walk toward your app, and suck its brains (memory) out | |
| ################# | |
| # INSTEAD OF | |
| # App.Vent.bind('some_event', _.bind(some_callback, this)) | |
| # App.Vent.bind('other_event', _.bind(other_callback, this)) | |
| # Do | |
| @bindGlobalEvents | |
| some_event: 'someCallback' |