Skip to content

Instantly share code, notes, and snippets.

View kjhangiani's full-sized avatar

Kevin Jhangiani kjhangiani

View GitHub Profile
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
eventName = 'keyup';
yo(event) {
console.log(event);
}
}
@kjhangiani
kjhangiani / adapters.application.js
Created February 8, 2018 00:25
polymorphic relationship - ember-data 2.13.2
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({
});
@kjhangiani
kjhangiani / adapters.application.js
Last active July 21, 2018 00:08
ember polymorphic sideload
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@kjhangiani
kjhangiani / interview-cron.md
Last active October 18, 2016 20:44
CRON to Dates API Endpoint

Cron2Date Parser

Summary

Create a javascript/node.js API endpoint that accepts a json payload of cron strings, and returns a json payload of valid dates for these strings. Include any applicable tests for this endpoint using the testing platform of your choice.

Details

Assume in our client software that we have a model defined as a "Frequency"

Each frequency contains two attributes: <string> name and <Array> crons. The name is guaranteed to be unique and the cron is a javascript array of strings (with cron format of "* * * * * *" representing "[sec] [min] [hr] [date] [month] [day of week]"). These cron strings determine when models implementing this frequency are processed. In this example, all cron strings will have "0 0 0" as the first 3 values, as we are interested only in dates, not times.

import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});