Skip to content

Instantly share code, notes, and snippets.

@timrwood
timrwood / moment.calendarWithoutTime.js
Created February 8, 2012 16:50
Moment calendar without time plugin
(function(){
var oldcal = moment.calendar;
var newcal = {
sameDay : '[Today]',
nextDay : '[Tomorrow]',
nextWeek : 'dddd',
lastDay : '[Yesterday]',
lastWeek : '[last] dddd',
sameElse : 'L'
};
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 / popout.txt
Last active November 21, 2019 15:22
YouTube and Vimeo video player popout bookmarklett
javascript:!function(){var h=location.href,y=h.match(/(youtu.be\/|v\/|u\/\w\/|embed\/|v=)([^#\&\? ]*).*/),v=h.match(/(vimeo.com\/)([^#\&\? ]*)/);y=y&&'http://www.youtube.com/watch_popup/?v='+y[2];v=v&&'http://player.vimeo.com/video/'+v[2];window.open(y||v,"_blank","height=345,width=560");}()
@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 / 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) {
@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
alias fact="elinks -dump randomfunfacts.com | grep '|' -B 2 -A 2"
alias p='fact && git pull --rebase'
alias up='fact && git push'