Skip to content

Instantly share code, notes, and snippets.

View cincodenada's full-sized avatar

Ell Bradshaw cincodenada

View GitHub Profile
@cincodenada
cincodenada / controllers.application\.js
Created May 25, 2021 00:14
Super in Handlers Example
import Controller from '@ember/controller';
const BaseController = Controller.extend({
actions: {
nameAlert: function(person){
window.alert('alert from BaseController: ' + person.lastName + ', ' + person.firstName);
}
}
})
@cincodenada
cincodenada / controllers.application\.js
Last active May 25, 2021 00:23
Super in Event Handlers
import Controller from '@ember/controller';
export default Controller.extend({})
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
checkReadOnly = false;
appName = 'Ember Twiddle';
}
@cincodenada
cincodenada / demo.js
Last active September 27, 2021 23:49
A version of my Bull demo script that attempts to clear jobs during their run, used to demonstrate bug #2167
const Queue = require('bull')
const delay = require('delay')
const shouldReAdd = process.argv.includes('--readd')
const timelog = (...args) => { console.log(+Date.now(), ...args) }
;(async () => {
timelog('Creating queue')
const queue = new Queue('example')
@cincodenada
cincodenada / esm-package.md
Last active October 19, 2022 00:42 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you to this page is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@cincodenada
cincodenada / apt-tree
Last active November 4, 2024 22:38 — forked from blais/apt-tree
apt-tree
#!/usr/bin/env python3
"""Display a graph of dependencies between Ubuntu packages.
Reads a list of packages from either a file or stdin.
Outputs a PDF.
"""
__author__ = "Martin Blais <[email protected]>"
import argparse
import logging
import random