Skip to content

Instantly share code, notes, and snippets.

var getData = function(callback){
showLoadingScreen();
$.ajax("http://someurl.com", {
complete: function(data){
hideLoadingScreen();
callback(data);
}
});
};
project
modelVersion 4.0.0/modelVersion
repositories
repository
id central/id
name Central Repository/name
url http://repo.maven.apache.org/maven2/url
layout default/layout
snapshots
@opsb
opsb / gist:11296568
Created April 25, 2014 17:09
zone file
development.lytbulbapp.com 3600 IN MX 5 client1.cloudmailin.net.
development.lytbulbapp.com 3600 IN MX 5 client2.cloudmailin.net.
lytbulbapp.com 3600 IN MX 5 client1.cloudmailin.net.
lytbulbapp.com 3600 IN MX 5 client2.cloudmailin.net.
stage.lytbulbapp.com 3600 IN MX 5 client1.cloudmailin.net.
stage.lytbulbapp.com 3600 IN MX 5 client2.cloudmailin.net.
@opsb
opsb / gist:d3754a4541a120c92cad
Last active August 29, 2015 14:02
Ember currentUser observer
Ember.SimpleAuth.Session.reopen({
updateCurrentUser: function() {
var self = this;
var userId = this.get('user_id');
if (!Ember.isEmpty(userId)) {
container.lookup('store:main').find('user', userId).then(function(user){
self.set("currentUser", user);
});
}
}.observes('user_id')
<html>
<head>
<script src='https://swww.tokbox.com/webrtc/v2.0/js/TB.min.js'></script>
<script>
var sessionId = "";
var apiKey = "";
var token = "";
var session = OT.initSession(sessionId);
OT.setLogLevel(OT.DEBUG);
self.session.on("sessionConnected", function(){
@opsb
opsb / es5-sham.js
Last active August 29, 2015 14:04
es5-sham-ember-cli
/*!
* https://github.com/es-shims/es5-shim
* @license es5-shim Copyright 2009-2014 by contributors, MIT License
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE
*/
// vim: ts=4 sts=4 sw=4 expandtab
//Add semicolon to prevent IIFE from being passed as argument to concated code.
;
@opsb
opsb / embedded-records-mixin.js
Last active August 29, 2015 14:04
Modified embedded-records-mixin taken from ember-data, adds _attributes to the end of keys for embedded records
var get = Ember.get;
var forEach = Ember.EnumerableUtils.forEach;
var camelize = Ember.String.camelize;
var pluralize = new Ember.Inflector();
App.EmbeddedRecordsMixin = Ember.Mixin.create({
/**
Serialize `belongsTo` relationship when it is configured as an embedded object.
@opsb
opsb / _post_json_callback
Last active August 29, 2015 14:05
Post a json callback request using capybara / jquery
def post_json_callback(path, payload)
script = "jQuery.ajax({url: '#{path}', type: 'POST', data: JSON.stringify(#{payload.to_json}), contentType: 'application/json; charset=utf-8'});"
page.execute_script(script)
end
@opsb
opsb / gist:a9ba07e014d5453c74c0
Created March 10, 2015 16:39
Output from adding a contact to peeps-ember-orbit with orbit-firebase
coalescedOp Object {id: "8e4cf064-2806-432b-80c2-0fa0e1256aec", op: "add", path: "contact/6019a8f4-ac77-431f-8574-1904375458a1", value: Object}
coalescedOp Object {id: "9abd2004-cd01-4e95-b208-26e12f28554b", op: "replace", path: "contact/6019a8f4-ac77-431f-8574-1904375458a1/firstName", value: "One"}
coalescedOp Object {id: "7c0b6656-de8e-4231-b10f-e152d9fa6730", op: "replace", path: "contact/6019a8f4-ac77-431f-8574-1904375458a1/lastName", value: "Two"}
coalescedOp Object {id: "8da526af-500d-40c4-9c63-0fcfe7326248", op: "replace", path: "contact/6019a8f4-ac77-431f-8574-1904375458a1/email", value: "Three"}
coalescedOp Object {id: "4a18200b-6e34-44a8-baff-07edc5fc78f1", op: "add", path: "phoneNumber/cc13720b-51b3-4156-8cb7-14103b187678", value: Object}
coalescedOp Object {id: "2e9dc5d2-dd76-44b1-b8f9-94c8edbf4fd8", op: "add", path: "contact/6019a8f4-ac77-431f-8574-1904375458a1/__rel/phoneNumbers/cc13720b-51b3-4156-8cb7-14103b187678", value: true}
coalescedOp Object {id: "c74030fe-d380-4675-be3b-c2d2c21fcbbb", op
@opsb
opsb / gist:1a0f20961b2d8713986f
Last active August 29, 2015 14:17
Operation processor
var OperationQueue = Class.extend({
init: function(){
Evented.extend(this);
this._queue = [];
},
process: function(operation){
this._queue.add(operation);
this.emit("operationAdded");
},