Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Pastore mwpastore

View GitHub Profile
@mwpastore
mwpastore / on-key.js
Created May 19, 2020
{{on-key}} modifier for Ember.js
View on-key.js
import { modifier } from 'ember-modifier';
import { isArray } from '@ember/array';
import { capitalize } from '@ember/string';
import { isEmpty, isPresent, typeOf } from '@ember/utils';
const { isInteger } = Number;
const parseKeys = arr => arr
.filter(_ => typeOf(_) === 'string')
@mwpastore
mwpastore / controllers.application\.js
Created Mar 9, 2020
(action (mut foo)) vs (fn (mut foo))
View controllers.application\.js
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked
prop;
@tracked
propDidUpdate = false;
@mwpastore
mwpastore / shares.conf
Last active Jan 9, 2020
Example of Samba ACL changes from 4.10 to 4.11
View shares.conf
[tank_active]
browsable = yes
read only = no
guest ok = no
valid users = @users
path = /tank/active
block size = 4096
write cache size = 131072
@mwpastore
mwpastore / cmdline.sh
Last active Dec 20, 2019
VCL snippets
View cmdline.sh
mkfs.ext4 -b 4k -C 128k -E num_backup_sb=0,packed_meta_blocks=1,root_owner=111:118 -O bigalloc,extent,flex_bg,^has_journal,mmp,sparse_super2 -L varnish-cache -N 64 -v /dev/sdc
@mwpastore
mwpastore / rg-refresh.sh
Last active Jun 4, 2018
Automated VLAN flop for AT&T RG workaround
View rg-refresh.sh
#!/bin/bash
###
# PURPOSE
#
# Execute a VLAN "flop" to allow the AT&T Residential Gateway (RG) to perform
# 802.1x authentication via the Optical Network Terminal (ONT) before falling
# back to the subscriber's "own" router/gateway hardware. The RG is toggled off
# and on as needed via a remote-controlled power outlet (see below).
#
# For more information about this procedure, please see brianlan's original
@mwpastore
mwpastore / -computed-promise.js
Last active Sep 28, 2017
Promise-aware compute macros
View -computed-promise.js
import computed from 'ember-macro-helpers/computed';
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
import { typeOf } from '@ember/utils';
import { all } from 'rsvp';
export default function(Proxy) {
const PromiseProxy = Proxy.extend(PromiseProxyMixin);
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
greeting: 'Hello',
actions: {
showAlert(message) {
const greeting = this.get('greeting');
alert(`${greeting}, ${message}!`);
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['endDate'],
startDate: '09/01/2017',
endDate: '09/30/2017'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
store: Ember.inject.service(),
count: 0,
foo: null,
init() {
this._super(...arguments);
You can’t perform that action at this time.