Skip to content

Instantly share code, notes, and snippets.

@hoIIer
hoIIer / css_escape_shim.js
Created August 9, 2021 17:43
CSS.escape shim function that works in browser & node.
/**
* CSS escape shim that works in both node and the browser.
*
* see: https://github.com/mathiasbynens/CSS.escape/blob/master/css.escape.js
*/
export function escape(sel) {
const result = [];
for (const [index, letter] of Array.from(sel).entries()) {
const charCode = letter.charCodeAt(0);
@hoIIer
hoIIer / ember-fetch-service.js
Created April 6, 2020 23:25
ember-fetch/ember-ajax compatible service
import Service, { inject as service } from '@ember/service';
import fetch, { Request } from 'fetch';
import config from 'ember-foo/config/environment';
export default class FetchService extends Service {
@service session;
headers() {
const headers = {};
const token = this.session.data.authenticated.token || config.token;