Skip to content

Instantly share code, notes, and snippets.

Drew Purdy andrewmp1

Block or report user

Report or block andrewmp1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View components.my-button.js
import Ember from 'ember';
export default Ember.Component.extend({
isDisabled: false,
actions: {
asyncAction() {
this.set('isDisabled', true);
let action = this.get('outside-action');
setTimeout(() => {
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@andrewmp1
andrewmp1 / attributes.json
Last active Sep 22, 2015 — forked from mikegreiling/attributes.json
AWS OpsWorks Deploy - Attribute Dump
View attributes.json
{
"opsworks": {
"activity": "deploy",
"sent_at": 1399533119,
"deployment": "33cb5d91-27c8-4e71-9d3e-e7925e5caa03",
"layers": {
"php-app": {
"name": "PHP App Server",
"id": "73271990-452b-4e5f-8a71-619e6441a447",
"elb-load-balancers": [
View aws-multipartUpload.js
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
View poltergeist_screenshot_helper.rb
# 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
View app.js.coffee
# /code/railsapp/app/assets/javascripts/thing/app.js.coffee
#= require angular/templates
angular.module("thing", ["app.templates"]).value("appName", "thing")
@andrewmp1
andrewmp1 / ember_helpers.js
Last active Dec 17, 2015
create an object of helper functions for use w/ ember
View ember_helpers.js
helpers = function EmberHelpers(App){
var app = App,
container = app.__container__;
var helper = {
routes: function(){
return app.Router.router.recognizer.names;
},
lookup = function(path){
return container.lookup(path);
},
@andrewmp1
andrewmp1 / ember_model.js
Last active Jul 2, 2016
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.
View ember_model.js
// 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,
@andrewmp1
andrewmp1 / test_helper.js
Last active Dec 15, 2015
Ember testing helper
View test_helper.js
var testing = function(app){
var container = app.__container__,
appController = container.lookup('controller:application'),
router = container.lookup("router:main");
var helper = {
path: function(){
return appController.get('currentPath');
},
routeName: function(){
View debounce.js
var callMethod = function(target, method, args) {
if (Ember.typeOf(method) === 'string') {
method = target[method];
}
return method.apply(target, args);
};
/**
Returns a function, that, when invoked, will only be triggered at most once during a given window of time.
*/
You can’t perform that action at this time.