Skip to content

Instantly share code, notes, and snippets.

@runspired
runspired / github-action-example.yml
Last active March 4, 2023 02:26
Parallel Brotli Compression in a Github Actions Workflow
# Ubuntu machines have 2 cores, but larger runners can have a lot more
# parallel will auto use number of virtual cores
# brotli, and parallel are both available out of the box on github's ubuntu machines
jobs:
build-assets:
steps:
- uses: actions/checkout@v3
# - name: Build
/* https://go.tacodewolff.nl/minify */
enScroll=!1,enFdl=!1,extCurrent=void 0,filename=void 0,targetText=void 0,splitOrigin=void 0;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{},extensions=["pdf","xls","xlsx","doc","docx","txt","rtf","csv","exe","key","pps","ppt","pptx","7z","pkg","rar","gz","zip","avi","mov","mp4","mpe","mpeg","wmv","mid","midi","mp3","wav","wma"];function a(e,t,n,o){const j="G-XXXXXXXXXX",r=()=>Math.floor(Math.random()*1e9)+1,c=()=>Math.floor(Date.now()/1e3),F=()=>(sStor._p||(sStor._p=r()),sStor._p),E=()=>r()+"."+c(),_=()=>(lStor.cid_v4||(lStor.cid_v4=E()),lStor.cid_v4),m=lStor.getItem("cid_v4"),v=()=>m?void 0:enScroll==!0?void 0:"1",p=()=>(sStor.sid||(sStor.sid=c()),sStor.sid),O=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},a="1",g=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +a,sSto
@alisdair
alisdair / intensify.sh
Created May 21, 2019 23:44
intensifies Slack emoji creator
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
# Number of frames of shaking
count=10
# Max pixels to move while shaking
@buschtoens
buschtoens / router.ts
Last active July 23, 2019 03:43
Engine Router Service
import Ember from 'ember';
import Service from '@ember/service';
import { action, computed } from '@ember/object';
import { getOwner } from '@ember/application';
import { reads } from '@ember/object/computed';
import { assert } from '@ember/debug';
import Evented from '@ember/object/evented';
import CoreObject from '@ember/object/core';
// Import { getEngineParent } from '@ember/engine/lib/engine-parent';
@monovertex
monovertex / .importjs.js
Last active November 16, 2018 20:59
Configuration for import-js build for an ember-cli project
module.exports = {
excludes: [
'./dist/**',
'./lib/**',
'./public/**',
'./tmp/**',
'./vendor/**',
],
useRelativePaths: false,
groupImports: true,
@runspired
runspired / push-deletion.js
Last active September 20, 2022 18:44
Useful Ember Data helpers
/*
notifying the store that a record has been remotely deleted and should be fully removed.
*/
function pushDeletion(store, type, id) {
let record = store.peekRecord(type, id);
if (record !== null) {
let relationships = {};
let hasRelationships = false;
@justincampbell
justincampbell / .importjs.js
Last active February 28, 2018 21:10
import-js Ember aliases/namedExports config
module.exports = {
emptyLineBetweenGroups: false,
importDevDependencies: true,
aliases: {
$: 'jquery',
Application: '@ember/application',
Component: '@ember/component',
Controller: '@ember/controller',
DS: 'ember-data',
Ember: 'ember',
avrdude -p atmega32u4 -P /dev/tty.usbmodem14411 -c avr109 -U flash:w:lets_split_rev2_xyverz.hex
ls /dev/tty*
@csswizardry
csswizardry / README.md
Last active April 2, 2024 20:17
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;