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
I am looking for a library that handles request.QUERY_PARAMS and converts the parameters into a database query that returns a queryset. | |
The pattern I am using arrises from Ember.js 's wish to be able to send queries of the following format to my back-end and have it return the desired queryset: | |
GET Request: http://myurl.com/api/modelname?attribute=value | |
where attribute is a property of the model and value is the targetted value | |
in the trivial case, it should be able to generate a query such as: |
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
require 'rake-pipeline-web-filters' | |
input "static" do | |
output "static/js/src" | |
#compile handlebars templates into Ember.TEMPLATES | |
match "coffee/templates/**/*.handlebars" do | |
handlebars | |
concat "templates.js" | |
end | |
end |
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
Here is the problem: | |
I have a UI button that adds new instaces of a DS.Model (App.FarmAnimal....trolling here). I am implementing a route-wide "undo/redo" system and I need to construct all actions such that an "opposite" action is also available. I do not want to change a flag such as "isActive" on the model instance from true to false but rather I want to truly delete it. If the model has been persisted, I will take care of alerting the user that their undo will delete a persisted model... This is not a concern. | |
I have used the following pattern to add a new model to the related Objects array of my parent model (App.Farm). | |
App.Farm.get('farmanimal').createRecord({type:"pig"}) | |
This works as intended but the reverse operation of deleting that record...not so much. |
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
Use gem to get rake-pipeline and rake-pipeline-web-filters (both on github w/ docs on installation/setup) | |
create an Assetfile in your project's root that looks something like the one shown below: | |
The handlebars compilation section is in the middle though you may check out the others for edification or whatnot. | |
require 'rake-pipeline-web-filters' | |
input "static" do | |
output "static/" | |
#compile the JS files that the coffeescript compiler outputs and wrap using minispade |
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
App.Router.map(function() { | |
this.route("menu", {path: "/menu"}); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
setup: function (context) { | |
this._super(context); | |
console.log('yo'); | |
}, |
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
App.Route.map () -> | |
@resource "clients" | |
@resource "client" | |
@resource "coaches" | |
@resource "coach" | |
@resource "coachedclients", {path: '/clients'} | |
App.Coachedclients = Ember.Route.extend | |
model: (params) -> | |
return App.Client.find(coach: @modelFor('coach')) |
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
fs = require('fs') | |
packageJSON = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf-8')) | |
npmTasks = [] | |
deps = Object.keys(packageJSON.dependencies) + Object.keys(packageJSON.devDependencies) | |
for dep in deps | |
if dep.search('grunt-') isnt -1 then npmTasks.push(dep) | |
#DO YOUR NORMAL grunt stuff here until you get to the location where you load your Npm tasks |
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
App.MyMixin = Ember.Mixin.create({ | |
sortedContent: function () { | |
//return sorted content | |
}.property('content'), | |
sortManagerClass: Ember.StateManager.extend({ | |
defaultState: "none", | |
none: Ember.State.extend({ | |
//define event responses |
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
<script type="text/x-handlebars"> | |
<h1>Dashboard</h1> | |
{{outlet cats}} | |
{{outlet dogs}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="cats"> | |
{{#each cat in controller.content}} | |
{{cat}} |
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
##Hey | |
here is some normal text |
OlderNewer