Skip to content

Instantly share code, notes, and snippets.

View knownasilya's full-sized avatar
🌒
And, behold, I come quickly; and my reward is with me.. Rev 22:12

Ilya Radchenko knownasilya

🌒
And, behold, I come quickly; and my reward is with me.. Rev 22:12
View GitHub Profile
@kentcdodds
kentcdodds / index.js
Created September 10, 2019 22:26
NodeJS file runner for Jest (create-node-runner using create-jest-runner). Use this with the runner option in jest config.
const {createJestRunner} = require('create-jest-runner')
module.exports = createJestRunner(require.resolve('./node-runner'))
@gr2m
gr2m / worker.js
Created August 27, 2019 05:40
A Cloudflare worker to exchange an OAuth Web Flow code for an access token. Configure your CLIENT_ID and CLIENT_SECRET and you are all set.
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const CLIENT_ID = '<your client ID>'
const CLIENT_SECRET = '<your client Secret>'
async function handleRequest(request) {
if (request.method === 'GET') {
return new Response(`$ curl -XPOST -H'Content-Type: application/json' -d'{"code": "<your oauth code>"}' ${request.url}`)
const colors = [
'transparent', // transparent
'#000', // black
'#fff', // white
// gray
'#f7fafc', // 100
'#edf2f7', // 200
'#e2e8f0', // 300
'#cbd5e0', // 400
@josemarluedke
josemarluedke / index.d.ts
Created May 4, 2019 04:41
Ember FastBoot service typescript type definitions
declare module 'ember-cli-fastboot/services/fastboot' {
import Service from '@ember/service';
interface Request {
method: string;
body: unknown;
cookies: unknown;
headers: unknown;
queryParams: unknown;
path: string;
@lukemelia
lukemelia / README.md
Last active April 21, 2023 17:13
keyboard-shortcut element modifer

An element modifier to attach a keyboard shortcut to an element that has a click method

Example usage:

  <button {{action 'doSomethingCool'}} {{keyboard-shortcut "D"}}>
    [D]o something cool
  </button>
@gossi
gossi / .explanation.md
Last active April 6, 2021 11:48
Ember Single File Component (markdown approach)

Ember Single File Component (markdown approach)

A syntax we are widely used to write is markdown, which also has a syntax to write blocks of code. In this variant of a potential SFC thingy, the only allowed "top-level-syntaxes" are code blocks. Based on the language they are assigned script, template or style. Everything other than code blocks is ignored (= comment)

References

@rdump
rdump / kubectl-multi-version-brews.md
Last active April 4, 2024 15:20
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

Applicability

The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository https://github.com/rdump/homebrew-versions

MacPorts is now keeping versioned installations available as well, by default.

/**
* @module ember-paper
*/
/* globals FastBoot */
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import TransitionMixin from 'ember-css-transitions/mixins/transition-mixin';
import { invokeAction } from 'ember-invoke-action';
@cowboyd
cowboyd / field.js
Last active January 15, 2019 22:56
A very, very rough draft of a custom field to perform validations on its input. (has not been tested)
/**
* A higher-order microstate that takes a validation function, and returns
* a field class that validates the input of that field based on inputs.
*/
export function Field(validationFn) {
return class Field extends String {
get validation() {
return validationFn(valueOf(this));
}
get hasErrors() {
@tomdale
tomdale / index.js
Created December 6, 2018 13:38
Tracked property notify API strawman
import Timer from 'simple-timer';
import Component from '@glimmer/component';
import { } from '@glimmer/tracking';
export default class TimerComponent extends Component {
constructor() {
// Mark the timer as "untracked" (i.e., we're asserting
// that timer contains no interior tracked properties at all).
// This function gives us back the timer as well as a callback
// function to call when any interior mutation may have occurred.