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:
# 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' |
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 |
Viz.WidgetsController = Ember.ArrayController.extend | |
init: -> | |
@refresh() | |
setInterval (=> @refresh), 5000 | |
refresh: -> | |
$.ajax | |
url: @get('src'), | |
type: "GET", | |
context: this, |
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:
def output name=((default=true); "caius") | |
puts "name: #{name.inspect}" | |
puts "default: #{default.inspect}" | |
end | |
output | |
# >> name: "caius" | |
# >> default: true | |
output "avdi" |
.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; |
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvkilybbL7t0VRLaTa+Du8Im7bO1ouZDoDnogD36bLScHCKEwH7awpQyqEtSKF+IFLw/rk+TfEEnTZZPX6gmnbuNK5LjGpbiQU5OtJe9l84ZynjmP+slKnbmdcF/1384ltA/q2KlMZy8JMwcvHUc22yK+Ysl3ftM9BDkQY20Qb+zbDjVfjRh5t4mXpCiNXku7ZPrdmkBkiHcTxi1fO2WLpDDXk0FjvFK+YLfKcB0v+BlKB1wakw06fn7B45v2ibIPcpf1gTzIeT0CuAPOYx/O9ZGtwU4PV9tNbMGfq+zm9j9MlE53gbeDlHiPkbwqvSkbqKHsRx1m1JMuPc7X8lNP2w== rlivsey@unbeliever.local |
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |