Skip to content

Instantly share code, notes, and snippets.

@mhluska
mhluska / document.js
Last active September 7, 2018 12:09
Simulate document.querySelector() in Ember FastBoot
import Service, { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
import { computed } from '@ember/object';
export default Service.extend({
fastboot: service(),
init() {
this._elemCache = {};
this._super(...arguments);
@mhluska
mhluska / fixtures.js
Last active March 13, 2019 22:43
No circular reference
const util = require('util')
norm_widget_1 = {
'foo': 1,
'bar': 'baz',
'_jv': {
'type': 'widget',
'id': '1',
'relationships': {
'widgets': {
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@mhluska
mhluska / fix-fastmail-1password.js
Created September 19, 2022 00:21
Fix for Fastmail Masked Email + 1Password Firefox extension prefill
for (const elem of document.querySelectorAll('[type="email"],[placeholder*=email i],[aria-label*=email i]')) {
const prevName = elem.name;
const clone = elem.cloneNode();
clone.name = 'email';
elem.replaceWith(clone);
setTimeout(() => { clone.replaceWith(elem) }, 5000);
}