Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Laiosa gitjeff05

  • Raleigh, NC
View GitHub Profile
@gitjeff05
gitjeff05 / remove_cell_outputs.sh
Last active Mar 16, 2020
Remove cell outputs and execution_count with the addition/merge operator in jq
View remove_cell_outputs.sh
local FILE
FILE=${1}
jq -r --indent 1 '. + { "cells": .cells
| map(. +
(if .cell_type == "code" then { "outputs": [], "execution_count": null } else {} end)
) }' "${FILE}"
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember.get() vs this.get() vs object.property',
emObj: null,
pojo: {
y: {
m: 'pojo'
}
},
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Notifying a property change on a property passed into a child component',
description: 'There is a parent component with some buttons. When a user clicks on a button, the buttons\'s action changes the property. Since the changed property is passed into the wrapped component, you would expect that it\'s observer would fire also. But it does not. To try this, just type in 1233 and you will see that the last 3 will not render.'
});
@gitjeff05
gitjeff05 / components.some-component.js
Last active Aug 29, 2015
Component Rendering Hooks
View components.some-component.js
import Ember from 'ember';
export default Ember.Component.extend({
someCondition: false,
componentName: 'some-component',
changeCondition: function() {
console.log(this.get('componentName') + ' on did insert element');
setTimeout(() => {
this.set('someCondition', true);
@gitjeff05
gitjeff05 / components.user-profile.js
Last active Aug 29, 2015
Ember Promises and Runloop
View components.user-profile.js
import Ember from 'ember';
export default Ember.Component.extend({
needs: ['users'],
moods: [],
name: Ember.computed.reads('user.name'),
userId: Ember.computed.reads('user.userId'),
showInfo: false,
status: Ember.computed.mapBy('moods', 'status'),
isLoading: false,