Skip to content

Instantly share code, notes, and snippets.

View yohanmishkin's full-sized avatar

yohanmishkin yohanmishkin

View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
tags: [],
blah: computed('[email protected]', function() {
if (isPresent(this.tags)) {
return get(this, 'tags')
.rejectBy('isDeleted')
@yohanmishkin
yohanmishkin / controllers.application.js
Last active September 5, 2019 14:10
dependent macros
import Ember from 'ember';
import { filterBy, readOnly, setDiff } from '@ember/object/computed';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
things: readOnly('model'),
truths: filterBy('things', 'is', true),
untruths: setDiff('things', 'truths'),
@yohanmishkin
yohanmishkin / doc.md
Last active December 31, 2019 07:06
Multi-stage builds in docker

Multi-stage builds in docker

Having spent a bit of time working to dockerize an API I wanted to share one of my learnings in case it’s helpful or interesting to others.

Granting access to private git repositories

The first issue I ran into was how to authenticate requests to gems we host privately on Github. We do this quite a bit throughout our repos.

So I needed a way to grant access to our docker image in order for bundler to run properly. Because were trying to build for production deployment I first decided to remove HTTPS repository references (https://github.com/ldock/) and replace them with SSH URLs ([email protected]:ldock/). But this introduced the challenge of getting the private key on the container securely. I needed the ability to get an authorized SSH key on the image when dependencies were being installed (bundle install) but I did not want to leave the key on the file system after the dependencies were installed.

@yohanmishkin
yohanmishkin / acceptance-test.js
Created April 12, 2019 20:32
Testing polling in Ember
module('Acceptance | Rooms', () => {
test('Room page polls for room data', async function(assert) {
assert.expect(2);
let pollingServiceMock = {
start(fetchingTaskInstance, pollingFrequency) {
assert.ok(fetchingTaskInstance, 'Polling started for rooms');
assert.equal(pollingFrequency, 5000, 'Poll every 5 seconds');
}
};
@yohanmishkin
yohanmishkin / 0-entries|index|template.hbs
Last active January 18, 2019 15:06
Ember component composition
<PotentialVisitor
@approveTask={{perform approveEntryTask}}
@denyTask={{perform denyEntryTask}}
@failedApprovalMessage="Error approving entry"
@failedDenialMessage="Error denying entry"
@successfulApprovalMessage={{entry.approvalMessage}}
as |potentialVisitor|
>
<TrackedPotentialVisitor
@eventName="Dashboard Entry - Reviewed"
@yohanmishkin
yohanmishkin / application.controller.js
Last active September 21, 2018 16:39 — forked from kybishop/application.controller.js
bug on inputs for query params
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['myValue'],
myValue: 1.2,
actions: {
updateValue(value) {
console.log(arguments);
import Ember from 'ember';
import { task } from 'ember-concurrency';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
items: computed('model', function() {
return this.get('model');
}),
doThis: task(function*(item) {
import Ember from 'ember';
import { task } from 'ember-concurrency';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
store: service(),
items: computed(function() {
let store = this.get('store');
return [
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@yohanmishkin
yohanmishkin / controllers.application.js
Last active May 23, 2018 00:59
rich vs. anemic domain modeling
import Ember from 'ember';
export default Ember.Controller.extend({
store: Ember.inject.service(),
post: null,
init() {
let post = this.get('store').createRecord('post');