Instantly share code, notes, and snippets.

View smoothscroll.js
/* ----------------------------------------------------------------------------------------------------------
03 scroll to #section-id-of-div
---------------------------------------------------------------------------------------------------------- */
function smoothScroll(el, target){
// if the hash is in the URL but not on the page... ex #cosmetic-surgery but not #section-this-div
if(el !== null){
var $this = $(el),
target = el.hash,
$target = $(target);
// check if the target has an offset, if its NOT undefined then run the code to allow things to scroll
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
thing: {
'first-name': 'Aaron',
'hello_last-name': '',
'status': '',
},
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
thing: {
'first-name': '',
'last-name': '',
'status': '',
},
actions: {
View adapters.application.js
import DS from 'ember-data';
import UrlTemplates from 'ember-data-url-templates';
export default DS.JSONAPIAdapter.extend(UrlTemplates, {
host: '',
namespace: 'api',
urlTemplate: '{+host}/{+namespace}/{pathForType}{/id}',
});
View controllers.foo.js
import Ember from 'ember';
export default Ember.Controller.extend({
people: Ember.computed.or('model.{current,previous}.value'),
isLoading: Ember.computed.reads('model.current.isRunning'),
fetchError: Ember.computed.reads('model.current.error'),
actions: {
fetchMore() {
this.send('refreshModel');
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
db: Ember.computed('refreshDb', function() {
let dump = window.server.schema.db.dump();
return JSON.stringify(dump, null, 2);
}),
View gist:adf4d1d584df69c064c7
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
db: Ember.computed('refreshDb', function() {
let dump = window.server.schema.db.dump();
return JSON.stringify(dump, null, 2);
}),
View components.app-activity-tree.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'ul',
display: Ember.computed('data.[]', function() {
return this.get('data').slice(-1)[0];
}),
nested: Ember.computed('data.[]', function() {
return this.get('data').slice(0, -1);
}),