I have a state machine for the major sections of the page:
App.States = Ember.StateManger.create({
foo: Ember.State.create({})
});
I have a view that needs to reset itself whenever the user enters the foo
state:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvkilybbL7t0VRLaTa+Du8Im7bO1ouZDoDnogD36bLScHCKEwH7awpQyqEtSKF+IFLw/rk+TfEEnTZZPX6gmnbuNK5LjGpbiQU5OtJe9l84ZynjmP+slKnbmdcF/1384ltA/q2KlMZy8JMwcvHUc22yK+Ysl3ftM9BDkQY20Qb+zbDjVfjRh5t4mXpCiNXku7ZPrdmkBkiHcTxi1fO2WLpDDXk0FjvFK+YLfKcB0v+BlKB1wakw06fn7B45v2ibIPcpf1gTzIeT0CuAPOYx/O9ZGtwU4PV9tNbMGfq+zm9j9MlE53gbeDlHiPkbwqvSkbqKHsRx1m1JMuPc7X8lNP2w== rlivsey@unbeliever.local |
.fake_file_input { | |
background: url(../images/fake_file_input.png) no-repeat; | |
cursor: pointer; | |
width: 150px; | |
height: 30px; | |
overflow: hidden; | |
position: relative; | |
display: inline-block; | |
*display: inline; | |
*zoom: 1; |
I have a state machine for the major sections of the page:
App.States = Ember.StateManger.create({
foo: Ember.State.create({})
});
I have a view that needs to reset itself whenever the user enters the foo
state:
Viz.WidgetsController = Ember.ArrayController.extend | |
init: -> | |
@refresh() | |
setInterval (=> @refresh), 5000 | |
refresh: -> | |
$.ajax | |
url: @get('src'), | |
type: "GET", | |
context: this, |
def all_replicas_in_sync?(verbose=false) | |
in_sync = true | |
# connect to the primary | |
mongo = Mongo::Connection.new(*MongoMapper.connection.primary) | |
db = mongo.db('local') | |
last_op=db.collection('oplog.rs').find.sort([['$natural',-1]]).limit(1).to_a[0] | |
db.collection('slaves').find().to_a.each do |slave| | |
opdiff = last_op['ts'].increment - slave['syncedTo'].increment | |
diff = (last_op['ts'].seconds - slave['syncedTo'].seconds)/1000.0 | |
in_sync = false if diff > 60 |
var qs = function(params) { | |
var pairs = []; | |
for (var key in params) { | |
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key])); | |
} | |
return pairs.join('&'); | |
}; | |
console.log( qs({foo: 'bar', text: 'hi there', base64: 'Q/6+d=='}) ); | |
// -> "foo=bar&text=hi%20there&base64=Q%2F6%2Bd%3D%3D" |
### | |
# Handy Ember NomBom | |
# N.B. Meant to be used with Super Spinner | |
# https://gist.github.com/zulaica/9e971cc5b6dbd156abcd13745beff262 | |
# | |
# Usage: | |
# $ nombom | |
# | |
# WTF: | |
# 1. Delete node_modules, bower_components, dist, and tmp directories |
# example view implements a simple dragging for mouse events. | |
Wall.DevView = Ember.View.extend | |
mouseDown: (ev) -> | |
ev.dispatcher.lock @, 'mouseMove', 'mouseUp' | |
@_mouseDown = @$().offset() | |
@_mouseDown.pageX = ev.pageX | |
@_mouseDown.pageY = ev.pageY | |
@_mouseDown.dispatcher = ev.dispatcher | |
console.log 'mouseDown' |
This is a brain dump of my experience trying to get something going with Ember.js. My goal was to get to know the ins and outs of the framework by completing a pretty well defined task that I had lots of domain knowledge about. In this case reproducing a simple Yammer feed. As of this time, I have not been able to complete that task. So this is a subjective rundown of the things I think make it difficult to get a handle on Ember. NOTE: My comments are addressing the Ember team and giving suggestions on what they could do to improve the situation.
The new guides have pretty good explanation of the various parts of the framework; routers, models, templates, views. But it's not clear how they all get strapped together to make something that works. There are snippets of examples all over the place like:
App.Router.map(function() {
match('/home').to('home');
});
$ = jQuery | |
queues = {} | |
running = false | |
queue = (name) -> | |
name = 'default' if name is true | |
queues[name] or= [] | |
next = (name) -> |