Skip to content

Instantly share code, notes, and snippets.

View mixonic's full-sized avatar

Matthew Beale mixonic

View GitHub Profile
test("it slices the array", function() {
expect(7);
deepEqual(get(obj, 'sliced'), [1, 2]);
Ember.run(function() {
// [0, 1, 2, 3, 4, 5]
obj.get('array').insertAt(0, 0);
});
@mixonic
mixonic / vcr_proxy.js
Last active January 1, 2016 00:59
Ember.js VCRProxy
// Record changes to an ObjectProxy and allow them to be stepped through
// or jumped to.
//
// For an example, see http://emberjs.jsbin.com/EJEcoxO/12/edit?html,js,output
//
// There is a bower/npm installable version of this library on GitHub:
// https://github.com/mixonic/ember-vcr-proxy
//
(function (global) {
@mixonic
mixonic / keybase.md
Last active August 29, 2015 14:02
keybase.md

Keybase proof

I hereby claim:

  • I am mixonic on github.
  • I am mixonic (https://keybase.io/mixonic) on keybase.
  • I have a public key whose fingerprint is C34B 0092 AF17 0AFC 9F22 3F5D 8FCD 4AB5 1F37 1A5E

To claim this, I am signing this object:

Pass at marketing copy

An authorization service library for your Ember.js application. <- Cory and I really like this as a tagline.

Torii is an authorization abstraction for Ember.js applications.

Adding social login to your Ember.js app just got a whole lot simpler.

Need an OAuth 2 authorization code? Let us do the heavy lifting.

@mixonic
mixonic / dependency-injection-and-service-lookup.md
Last active August 29, 2015 14:03
Dependency Injection & Service Lookup

Dependency Inject & Service Lookup

Dependency injection and service lookup are two important framework concepts. The first, dependency injection, refers a dependent object being injected onto another object during instantiation. For example, all route objects have the property router set on them during instantiation. We say that the dependency of the router has been injected onto the route objects.

App.IndexRoute = Ember.Route.extend({
  actions: {
    showPath: function(){
      // Dependency injection provides the router object to our
      // route instance.
@mixonic
mixonic / buffered-store-proxy.md
Created July 2, 2014 16:06
Buffered Store Proxy

If you have worked much with Ember-Data, then you know the buffered object proxy pattern:

http://coryforsyth.com/2013/06/27/ember-buffered-proxy-and-method-missing/

This pattern allows us to put changes to a model into a buffer instead of on the model itself. There are several benefits of this:

  • If the model has changes come from a push source (an attribute is updated), the changes will not destroy what the user is currently entering.
  • Saves can be de-coupled from dirty tracking. If you are saving a model as a user types, the model in flight will not accept changes from the user. You will get the dreaded cannot change an object inFlight error. With a buffer, you can commit the buffer to the model and save the model, then allow the user to keep making edits against a new buffer. No conflict.
  • In general, a buffer allows you to treat Ember-Data records more like database rows. You lock them for modification (while persisting them) but only for the shortest time possible. An object is made dirty then sav
@mixonic
mixonic / index.html
Last active August 29, 2015 14:05
Form Validation - Model#validate // source http://jsbin.com/afetez/280
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Image Search</title>
<script src='http://code.jquery.com/jquery.js'></script>
<script src='https://rawgit.com/dmdez/simple-masonry/master/jquery.simplemasonry.js'></script>
<script src='http://underscorejs.org/underscore.js'></script>
<script src='http://backbonejs.org/backbone.js'></script>
<style>
@mixonic
mixonic / gist:5a3692f1e86819a2f301
Last active August 29, 2015 14:05
EmberFest meet-up

Howdy friends and colleagues at EmberFest!

We hope you are enjoying the sunshine and beaches of Barcelona. Please join us for a casual pre-conference gathering tonight (Tuesday) at our flat, a ten minute walk north of the conference hotel:

5pm to 8pm

Passatge Taulat 14, 08019, Barcelona

https://goo.gl/maps/AXnd6

import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});