Skip to content

Instantly share code, notes, and snippets.

View andrewmp1's full-sized avatar

Drew Purdy andrewmp1

View GitHub Profile
# /code/railsapp/app/assets/javascripts/thing/app.js.coffee
#= require angular/templates
angular.module("thing", ["app.templates"]).value("appName", "thing")
# spec/support/poltergeist_screenshot_helper.rb
module PoltergeistScreenshotHelper
# FROM http://blog.jerodsanto.net/2012/12/capybara-and-poltergeist-snap/
def snap!(options={})
path = options.fetch :path, "~/.Trash"
file = options.fetch :file, "#{Time.now.to_i}.png"
full = options.fetch :full, true
path = File.expand_path path
@andrewmp1
andrewmp1 / ember_model.js
Last active July 2, 2016 17:36
Ember-data has existed for quite a while and seems to actually have a very good api for interfacing w/ a model. Maybe we should include it in ember.js as a public interface. See introduction.md for more thoughts.
// Ember.Model has slowly developed a stable API. Lets make it an interface.
Ember.Model = Ember.Object.extend(Ember.Evented, {
/**
Reference the original json that created the record.
@method data
@returns {Object} of data used to create the record
*/
data: Ember.K,
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
isDisabled: false,
actions: {
asyncAction() {
this.set('isDisabled', true);
let action = this.get('outside-action');
setTimeout(() => {