Skip to content

Instantly share code, notes, and snippets.

View alexlafroscia's full-sized avatar
👋
Looking for work! Need experience with Svelte or Ember.js? Get in touch!

Alex LaFroscia alexlafroscia

👋
Looking for work! Need experience with Svelte or Ember.js? Get in touch!
View GitHub Profile
@alexlafroscia
alexlafroscia / find_mutations.py
Last active February 1, 2016 03:13
Find mutations of a string
from sys import argv
def has_mutation(c):
if c == 't':
return '7'
if c == 'e':
return '3'
return None
@alexlafroscia
alexlafroscia / components.my-component.js
Last active July 29, 2016 21:32
Verify jQuery Trigger Bug in 2.8.0
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['my-component'],
foo: 'not clicked',
click() {
this.set('foo', 'clicked');
}
@alexlafroscia
alexlafroscia / controllers.application.js
Last active September 29, 2016 21:36
selection-wizard component
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
selections: [],
actions: {
'log-transition'(name, value) {
this.get('selections').pushObject(value);
@alexlafroscia
alexlafroscia / launch.json
Created October 7, 2016 01:19
Run `ember test` from VS Code
{
"version": "0.2.0",
"configurations": [
{
"name": "ember test",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/.bin/ember",
"args": ["test"],
"sourceMaps": false,
@alexlafroscia
alexlafroscia / controllers.application.js
Last active November 29, 2016 17:01
No timeout with pauseTest
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import { task, timeout } from 'ember-concurrency';
function asyncComputed(...deps) {
let taskFn = deps.pop();
let fn = task(taskFn).restartable().toFunction();
return Ember.computed(...deps, function() {
let args = deps.map(dep => this.get(dep));
return fn(...args);
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@alexlafroscia
alexlafroscia / controllers.application.js
Last active December 7, 2016 22:38
ember-block-slots vs Ember v2.10.0
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@alexlafroscia
alexlafroscia / controllers.application.js
Last active January 26, 2017 18:10
Dismiss popover on link focus-out
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
popoverVisible: false,
actions: {
showPopover() {
this.set('popoverVisible', true);
import Ember from 'ember';
import connect from 'ember-redux/components/connect';
const stateToComputed = (state) => {
return {
numberOfTypes: state.cart.length,
totalCartCount: state.cart.reduce((totalCount, product) => totalCount += product.count, 0),
cartItems: state.cart
};
};