Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
import { computed } from '@ember/object'
export default Ember.Controller.extend({
people: {
'Mr. Chris': ['foo', 'bar'],
'Mr. Tim': ['fiz', 'baz']
},
people2: computed(function(){
const out = {}
@timrwood
timrwood / controllers.application.js
Last active October 3, 2018 13:34
Template Only CSS Classes
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@timrwood
timrwood / controllers.application.js
Created April 2, 2018 17:26
Ember Data meta relationship
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
parents: null,
actions: {
clear() {
this.store.unloadAll('parent');
@timrwood
timrwood / month day
Created February 25, 2016 18:21
Date picker ui
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7
4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14
11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21
18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28
25 26 27 28 29 30 31 29 30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
@timrwood
timrwood / timezones.md
Last active January 14, 2016 02:02
Unique timezones for 2015
Offsets Time of Change Abbr Zone Candidates
-11:00 ??? Pacific/Pago_Pago
-11:00 NUT Pacific/Niue
-11:00 BST Pacific/Pago_Pago Pacific/Midway Pacific/Samoa
-10:00 -09:00 Mar 08 03:00 Nov 01 01:00 HDT HST America/Adak America/Atka
-10:00 ??? Pacific/Honolulu
-10:00 TAHT Pacific/Tahiti
@timrwood
timrwood / 2015a.js
Created May 13, 2015 14:32
Moment Timezone Data
moment.tz.load({
"version": "2015a",
"zones": [
"Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q",
"Africa/Accra|LMT GMT GHST|.Q 0 -k|012121212121212121212121212121212121212121212121|-26BbX.8 6tzX.8 MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE",
"Africa/Addis_Ababa|LMT EAT BEAT BEAUT|-2r.g -30 -2u -2J|01231|-1F3Cr.g 3Dzr.g okMu MFXJ",
"Africa/Algiers|PMT WET WEST CET CEST|-9.l 0 -10 -10 -20|0121212121212121343431312123431213|-2nco9.l cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0",
"Africa/Bangui|LMT WAT|-d.A -10|01|-22y0d.A",
"Africa/Bissau|LMT WAT GMT|12.k 10 0|012|-2ldWV.E 2xonV.E",
"Africa/Blantyre|LMT CAT|-2a.k -20|01|-2GJea.k",
@timrwood
timrwood / grouped-by-offsets.js
Last active August 29, 2015 14:21
Alternate moment timezone current timezone filters.
}
function matchesAtIndex (zone, i) {
var aDay = 50 * 24 * 60 * 60 * 1000;
if (i < zone.offsets.length - 1 && new Date(zone.untils[i] + aDay).getTimezoneOffset() !== zone.offsets[i + 1]) {
// console.log(zone.name, new Date(zone.untils[i] + aDay).getTimezoneOffset(), zone.offsets[i + 1], '+1');
// console.log(zone.name, zone.untils[i + 1], aDay, zone.untils[i + 1] + aDay);
return false;
}
// console.log(zone.name, new Date(zone.untils[i] - aDay).getTimezoneOffset(), zone.offsets[i]);
* { outline: 1px solid red; }
*:before { outline: 1px dotted #800000; }
*:after { outline: 1px dashed #ff8080; }
* * { outline: 1px solid #ff4d00; }
* *:before { outline: 1px dotted #802600; }
* *:after { outline: 1px dashed #ffa680; }
* * * { outline: 1px solid #ff9900; }
* * *:before { outline: 1px dotted #804d00; }
* * *:after { outline: 1px dashed #ffcc80; }
* * * * { outline: 1px solid #ffe500; }
@timrwood
timrwood / dirty-helpers.js
Created November 9, 2014 00:13
Ember Data Dirty Relationships Mixins
import Ember from 'ember';
export { dirtyHasMany, dirtyBelongsTo, dirtyMixin };
var dirty = 'relationshipIsDirty';
function dirtyMixin (obj) {
var args = Object.keys(obj);
var comp = Ember.computed;
args.push('isDirty');
obj[dirty] = comp.any.apply(comp, args);
@timrwood
timrwood / moment-immutable.js
Created September 16, 2014 17:16
Immutable Moments
(function (root, factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define(['moment'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('moment'));
} else {
factory(root.moment);
}
}(this, function (moment) {