Skip to content

Instantly share code, notes, and snippets.

@hmcq6
hmcq6 / controllers.application.js
Last active January 29, 2020 16:27
Hanging Route Test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@hmcq6
hmcq6 / controllers.application.js
Created May 31, 2019 16:17
Empty brace expansion
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
a: 1,
aa: 2,
ab: 3,
sum: Ember.computed('a{,a,b}', function() {
const { a, aa, ab } = this.getProperties('a', 'aa', 'ab');
return a + aa + ab;
@hmcq6
hmcq6 / components.my-clock.js
Last active May 30, 2019 21:39
Leaking Listener Test
import Ember from 'ember';
export default Ember.Component.extend({
time: null,
_handler: null,
didInsertElement() {
this._super(...arguments);
console.log(this.time);
this.set('_handler', function() {
console.log('wiggity');
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@hmcq6
hmcq6 / controllers.application.js
Created February 7, 2019 18:35
Setting computed to same value doesn't trigger recompute
import Ember from 'ember';
let uuid = 0;
const { get, set } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
num: 5,
newUUID: Ember.computed('num', function() {
++uuid;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
food: [
Ember.Object.create({
name: 'taco',
reviews: [Ember.Object.create({
rating: 5
})]
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
test: undefined,
actions: {
toggle() {
this.toggleProperty('test');
}
}
@hmcq6
hmcq6 / Adding features to Quill + Ember.md
Last active October 26, 2018 19:07
Adding features to Quill + Ember

Solution

Thanks to @demersus, it was discovered that the issue has to do with some irregularity around imports/exports. The solution that was found is to register the format with Quill in the same file it is defined in. Additionally the format must be imported into the snow-with-payment theme to ensure the format is registered.

After struggling for a few days to upgrade the link feature of Quill I've decided to write down my thoughts. To get help from other devs and keep a record of how to do this in the future.

Parchment

The first step in learning how to add features to Quill is to understand Parchment, Quills internal representation for the DOM. Quill represents elements with its Blots while smaller changes to those elements (like setting an attribute) can be done with Attributors.

@hmcq6
hmcq6 / A river runs through Git.md
Last active September 22, 2017 00:56
A short guide on proper Git flow

A river runs through Git

A short guide on proper Git flow

My name is Hassan McKusick, you can also find me by the moniker @hmcq6. I've been a professional Software Engineer for a little over 7 years, and I've been a hobbyist programmer for over 18. I've made over 1,600 commits on 700+ pull requests with a ~90%+ merge rate.

Since 2011 I have used git for every professional project and serious side project that I've worked on. The following details my normal git flow, and will include tips to make using git easier and more effective.

Right off the bat I'd like to acknolwedge that there are many ways to use git/github. I'm not claiming my way is the only way, this process however has always worked for me.

Getting started

let searchTerms = searchBox.value.match(/\S+/g) || []; // "People's Republic"
$children.filter((_, { textContent }) => ( // "People's Republic of Bangladesh"
!searchTerms.reduce((all, term) => ( // [ "People's", "Republic" ]
all && textContent.
match(/\S+/g). // [ "People's", "Republic", "of", "Bangladesh" ]
reduce((any, word) => any || word.includes(term), false) // true
), true) // Remove from array to be hidden if all search terms have a match
)).hide();