Skip to content

Instantly share code, notes, and snippets.

View mwpastore's full-sized avatar

Mike Pastore mwpastore

  • Chicago, Illinois
View GitHub Profile
- apt_key:
url: https://repo.varnish-cache.org/GPG-key.txt
- apt_repository:
repo: deb https://repo.varnish-cache.org/ubuntu/ {{ ansible_distribution_release }} varnish-4.1
filename: varnish-cache
- apt:
update_cache: yes
name: varnish
@mwpastore
mwpastore / mwpastore_week1.erl
Created March 4, 2017 00:29
FutureLearn — Functional Programming in Erlang — Week 1
-module(mwpastore_week1).
-export([area/1, perimeter/1, enclose/1, bits/1]).
area({square, L}) ->
L * L;
area({rectangle, H, W}) ->
H * W;
area({circle, R}) ->
math:pi() * R * R;
area({triangle, A, B, C}) ->
@mwpastore
mwpastore / mwpastore_week2.erl
Last active March 7, 2017 03:51
FutureLearn — Functional Programming in Erlang — Week 2
-module(mwpastore_week2).
-export([
shunt/2, reverse/1,
join/2, concat/1,
member/2,
msort/1, qsort/1, isort/1,
perms/1
]).
shunt([], Ys) -> Ys;
@mwpastore
mwpastore / controllers.application.js
Created April 23, 2017 16:32
ember-composable-helpers#263
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
receivedArg: null,
save(arg) {
return this.set('receivedArg', `-->${arg}<--`);
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import computed from 'ember-macro-helpers/computed';
const Foo = Ember.ArrayProxy.extend({
content: [],
expected: computed('content.@each.qux', content => JSON.stringify({ content })),
actual: computed('@each.qux', content => JSON.stringify({ content }))
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@mwpastore
mwpastore / .eslint.js
Created July 10, 2017 22:11
eslint rule for arrow function parens styling
module.exports = {
// ..
rules: {
'arrow-parens': [2, 'as-needed', { requireForBlockBody: true }],
// ..
}
// ..
}
@mwpastore
mwpastore / address-model.js
Last active July 28, 2017 13:03
ember-cp-validations preprocessor and helper for deferred validations
import Model from 'ember-data/model';
import { validator } from 'ember-cp-validations';
import attr from 'ember-data/attr';
import buildValidations from '../utils/build-validations';
const ValidationsMixin = buildValidations({
street: {
deferred: true, // N.B.
validators: [