Skip to content

Instantly share code, notes, and snippets.

@rlivsey
rlivsey / id_rsa.pub
Created May 7, 2011 15:52
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvkilybbL7t0VRLaTa+Du8Im7bO1ouZDoDnogD36bLScHCKEwH7awpQyqEtSKF+IFLw/rk+TfEEnTZZPX6gmnbuNK5LjGpbiQU5OtJe9l84ZynjmP+slKnbmdcF/1384ltA/q2KlMZy8JMwcvHUc22yK+Ysl3ftM9BDkQY20Qb+zbDjVfjRh5t4mXpCiNXku7ZPrdmkBkiHcTxi1fO2WLpDDXk0FjvFK+YLfKcB0v+BlKB1wakw06fn7B45v2ibIPcpf1gTzIeT0CuAPOYx/O9ZGtwU4PV9tNbMGfq+zm9j9MlE53gbeDlHiPkbwqvSkbqKHsRx1m1JMuPc7X8lNP2w== rlivsey@unbeliever.local
@nathansmith
nathansmith / file_input_example.css
Created December 9, 2011 14:56
Markup to Hide a File Input
.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;
@jamesarosen
jamesarosen / ember-views-and-states.md
Created January 11, 2012 00:21
On Ember Views & States

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,
@justindossey
justindossey / gist:2063267
Created March 17, 2012 17:38
MongoMapper-- check that replicas are within a minute of primary
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"
@zulaica
zulaica / handy_ember_nombom.bash
Last active June 24, 2016 09:59
Handy Ember NomBom
###
# 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
@charlesjolley
charlesjolley / dev_view.coffee
Created August 21, 2012 03:57
Adding event locks to Ember
# 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'
@polotek
polotek / ember_hurdles.md
Last active March 30, 2017 05:37
Hurdles getting started with Ember.js

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.

App setup

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');
});
@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->