Skip to content

Instantly share code, notes, and snippets.

View nummi's full-sized avatar
😺
Working from home

Jerry Nummi nummi

😺
Working from home
View GitHub Profile
export default function(error) {
error = new Error(error);
if (error.message) { console.log('\n' + error.message + '\n'); }
if (error.stack) { console.log('\n' + error.stack + '\n'); }
}
@nummi
nummi / transitiontest
Created May 6, 2015 18:34
transition name
Ember.transitionEventName = function() {
var t;
var el = document.createElement('fakeelement');
var transitions = {
'transition':'transitionend',
'OTransition':'oTransitionEnd',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
};
@nummi
nummi / component.js
Last active August 29, 2015 14:14
Tahi Overlay
import Ember from 'ember';
import OverlayComponent from 'tahi/pods/components/overlay/component';
export default OverlayComponent.extend({
fileUploadURL: '/files/important/',
importantFileIsUploaded: Ember.computed.notEmpty('model.file.src'),
actions: {
importantFileDidUpload: function(data) {
this.store.pushPayload('importantFile', data);
import Ember from 'ember';
var cancelDragEvent = function(e) {
e.preventDefault();
e.stopPropagation();
return false;
};
export default {
dragItem: null,
@nummi
nummi / flash-message component.js
Last active August 29, 2015 14:14
Ember Flash Messages, Component, Service and Initializer
// app/pods/components/flash-message/component.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['flash-message'],
classNameBindings: ['type'],
layoutName: 'flash-message',
type: function() {
@nummi
nummi / content_editable_view.js.coffee
Last active March 24, 2016 00:47
Ember Content Editable Component w/ Placeholder
# modified from: https://github.com/KasperTidemann/ember-contenteditable-view
App.ContentEditableComponent = Em.Component.extend
attributeBindings: ['contenteditable', 'placeholder']
editable: true
placeholder: null
plaintext: false
preventEnterKey: false
@nummi
nummi / projections
Created November 15, 2013 15:19
Rails.vim ember key bindings
//So you use [rails.vim](https://github.com/tpope/vim-rails) and you're angry that you can't use it because you're not in a rails project and you're in Ember-land. Well do the following and get back to coding:
//1. `touch config/environment.rb` Don't worry, it's in the `.gitignore`
//2. Copy this configuration into `config/projections.json` (also in `.gitignore`)
```javascript
{
"app/js/models/*.js": {
"command": "model",
"alternate": "spec/models/%s_spec.js",
@nummi
nummi / gist:7452673
Last active December 28, 2015 05:49
App.OldAndBustedRoute = App.Route.extend({
/*
Calling find from the model hook will block page rendering until (I think) the promise is fulfilled.
*/
model: function(params) {
return this.store.find('collection', params.collection_id);
},
setupController: function(controller, model) {
controller.set('isLoading', true);
@nummi
nummi / gist:5785054
Last active December 18, 2015 12:48
App.Order = DS.Model.extend({
items: DS.hasMany('App.OrderItems'),
orderTotal: function() {
return this.get('items')
.reduce(function(previousValue, item, index) {
return item.get('price') + previousValue;
}, 0);
}.property('items', 'items.@each', 'items.@each.cost')
})
@nummi
nummi / media.sass
Created October 16, 2012 20:51
Media Query Sass
=respond-to($device)
@if $device == handheld
@media only screen and (min-width : 320px)
@content
@if $device == tablet
@media only screen and (min-width : 600px)
@content
@if $device == tablet-landscape