Skip to content

Instantly share code, notes, and snippets.

View mikegrassotti's full-sized avatar

Michael Grassotti mikegrassotti

View GitHub Profile
class ExampleClient
include HTTParty
extend HTTPExceptions
parser Class.new HTTParty::Parser
parser.send :include, PresentParser
parser.send :include, MashedParser
end
@mikegrassotti
mikegrassotti / login_controller.js
Created January 5, 2013 00:20
Example of transitionTo from the controller
App.LoginController = Ember.ObjectController.extend
reset: ->
record = Redbot.Session.createRecord()
@set('content', record)
record.on 'didCreate', @, 'success'
record.on 'becameInvalid', @, 'failure'
save: (event)->
@store.commit()
@mikegrassotti
mikegrassotti / how-it-works.js
Last active December 10, 2015 17:48
Drafting documentation for ember router v2 events

How it works:

When a Handlebars template uses the {{action}} helper, it will attempt to send the event to the view's controller.

If the controller does not have the action, it will attempt to send the event to it's target. By default, a controller's target is set to the router after it is instantiated by Ember.Application#initialize.

Previously, the router events received this

@mikegrassotti
mikegrassotti / gist:4541353
Last active December 11, 2015 03:58
Ember.js WhereAmI
recognizer = App.Router.router.recognizer;
console.log Em.keys(recognizer.names)
App.Router.router.currentHandlerInfos shows you where you are at
@mikegrassotti
mikegrassotti / ember-qunit.html
Created January 22, 2013 02:40
qUnit test from jsbin
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[SO]" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<!-- <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" /> -->
<!-- <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" /> -->
// Version: v1.0.0-pre.2-484-g0f93e71
// Last commit: 0f93e71 (2013-01-22 14:03:41 -0500)
(function() {
/*global __fail__*/
/**
Ember Debug
@mikegrassotti
mikegrassotti / jsbin.html
Created January 23, 2013 02:42
Red Rover QUnit JSBin Template
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css">
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-pre.4.js"></script>
<script src="http://f.cl.ly/items/2y0X3M0F2K2O1W1O1w0f/ember-data.js">
</script>

how i learned to stop worrying and love the router

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<meta name="description" content="[SO] second-ember-template-prevents-first-from-being-displayed" />
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-pre.4.js"></script>