Want to work locally on your web site but have your changes periodically (like every minute) updated on Heroku?
#!/bin/bash
while [ true ]
do
echo "Pushing recent changes to Heroku..."| Math.lerp = Math.lerp || function(a, p1, p2) { | |
| return (p2 - p1) * a + p1; | |
| }; | |
| Math.alpha = Math.alpha || function(a, p1, p2) { | |
| return (a - p1) / (p2 - p1); | |
| }; | |
| Math.clamp = Math.clamp || function(a, p1, p2) { | |
| if (p2 > p1) { | |
| if (a < p1) { | |
| return p1; |
| <script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js" | |
| type="text/javascript" | |
| charset="utf-8"></script> | |
| <script type="text/coffeescript"> | |
| # Some CoffeeScript | |
| </script> |
(Note: this procedure will work pretty well for simple additions of properties on models, and the like. More complex changes will require more thought.)
Let's assume you have a branch off of master that has been creating lots of migrations. It forked when master was at 0017_migration_on_master.py. Now, on the branch, let's call it data-crazy, we're up to 0028_migration_on_data_crazy.py. Sadly, someone had to jump onto master and make a schema change to the database. This bumped master up to 0018_migration_on_master.py. Now, we need to merge those changes into data-crazy in order to eventually be able to merge back into master once we're stable and our feature is complete.
| import pdb | |
| from subprocess import call | |
| breakpoint = pdb.set_trace | |
| def set_trace(): | |
| call(["say", "break point"]) | |
| breakpoint() | |
| pdb.set_trace = set_trace |
| [contenteditable] { | |
| border: 2px solid rgba(0,0,0,0); | |
| } | |
| [contenteditable]:hover { | |
| border: 2px dashed #eeeeee; | |
| } | |
| [contenteditable]:empty { | |
| border: 2px dashed #ddeeee; | |
| font-style: italic; | |
| } |
| class MyModel extends Backbone.Model | |
| sync: (method, model, options) => | |
| console.log 'MyModel : info : trying to coerce property_X to be property_Y when pushed to server' | |
| if method in ['create', 'update', 'patch'] | |
| options.attrs = @toJSON(options) | |
| options.attrs.property_Y = @get('property_X') | |
| delete options.attrs.property_X | |
| super | |
XHR
model = {
property_a: 'hello',
property_b: 'world'
};
xhr=jQuery.ajax({type:'post', dataType:'json', url:'http://localhost:8000/api/...', data:JSON.stringify(model),'contentType':'application/json'})| ### | |
| # Backbone views | |
| ### | |
| # | |
| # Handling subviews: | |
| # http://stackoverflow.com/questions/9337927/how-to-handle-initializing-and-rendering-subviews-in-backbone-js | |
| # Basic render strategy: | |
| # http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simple/ |