Skip to content

Instantly share code, notes, and snippets.

View einSelbst's full-sized avatar
💭
Me, looking through the window of opportunity.

einSelbst einSelbst

💭
Me, looking through the window of opportunity.
  • Berlin / BalticSea
View GitHub Profile
@AJolly
AJolly / bitmexusd.user.js
Last active September 12, 2019 01:51 — forked from QuantBits/script.js
BitMex USD Converter - For TemperMonkey
// ==UserScript==
// @name BitMex USD Converter
// @namespace https://bitmex.com/
// @version 0.13
// @description Get some sanity into your gambling.
// @author koinkraft, modified by @Jolly - https://www.twitter.com/Jolly
// @grant none
// @include https://bitmex.com/*
// @include https://www.bitmex.com/*
// @require https://code.jquery.com/jquery-2.1.4.min.js
@metasean
metasean / README.md
Created June 30, 2017 03:09
How to share a webpack config between next.js and Storybook
@chooie
chooie / 3_things_ive_learned_in_5_years_of_javascript_software_development.md
Last active January 4, 2022 01:17
3 things I've learned in 5 years of JavaScript Software Development

3 things I've learned in 5 years of JavaScript Software Development

Code should lead with the higher-level concepts. The lower-level pieces should follow

Don't force the reader of your code to scroll past the minutiae.

function makeBreakfast() {
  const ingredients = fetchIngredients();
  const friedBacon = fryBacon(ingredients.bacon);
  const cookedScrambledEggs = whiskEggsAndFryThem(ingredients.eggs);
 const preparedMeal = plateAndSeasonMeal(friedBacon, cookedScrambledEggs);
@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.

@pedrouid
pedrouid / iso-639-1.json
Last active August 23, 2022 22:41
ISO-639-1 Languages (including matching ISO-639-1, ISO-639-2B, ISO-639-2T and ISO-639-3 codes)
[
{
"name": "Afar",
"type": "living",
"scope": "individual",
"iso-639-3": "aar",
"iso-639-2B": "aar",
"iso-639-2T": "aar",
"iso-639-1": "aa"
},
@OrderAndCh4oS
OrderAndCh4oS / iso-3166-country-codes.ts
Last active August 23, 2022 22:46
ISO 3166 Country Codes Typescript Object JSON
// https://www.iso.org/obp/ui/#search
const isoCountryCodes = [
{name: 'Andorra', alphaTwoCode: 'AD', alphaThreeCode: 'AND', numeric: '020'},
{name: 'United Arab Emirates', alphaTwoCode: 'AE', alphaThreeCode: 'ARE', numeric: '784'},
{name: 'Afghanistan', alphaTwoCode: 'AF', alphaThreeCode: 'AFG', numeric: '004'},
{name: 'Antigua and Barbuda', alphaTwoCode: 'AG', alphaThreeCode: 'ATG', numeric: '028'},
{name: 'Anguilla', alphaTwoCode: 'AI', alphaThreeCode: 'AIA', numeric: '660'},
{name: 'Albania', alphaTwoCode: 'AL', alphaThreeCode: 'ALB', numeric: '008'},
{name: 'Armenia', alphaTwoCode: 'AM', alphaThreeCode: 'ARM', numeric: '051'},
{name: 'Angola', alphaTwoCode: 'AO', alphaThreeCode: 'AGO', numeric: '024'},
@OrderAndCh4oS
OrderAndCh4oS / iso-639-1-lookup.json
Last active August 23, 2022 22:47
iso-639-1 language code to iso-639-2 look up json
{
"ab": {
"iso-639-2": [
"abk"
],
"iso-639-1": "ab",
"english": "Abkhazian",
"french": "abkhaze",
"german": "Abchasisch"
},
@OrderAndCh4oS
OrderAndCh4oS / iso-639-2-lookup.json
Last active August 23, 2022 22:48
iso-639-2 language code to iso-639-1 look up json
{
"abk": {
"iso-639-2": "abk",
"iso-639-1": "ab",
"english": "Abkhazian",
"french": "abkhaze",
"german": "Abchasisch"
},
"ace": {
"iso-639-2": "ace",
# config/initializers/activestorage.rb
Rails.application.config.to_prepare do
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
ActiveStorage::Attached::Macros.module_eval do
def has_one_attached(name, dependent: :purge_later, acl: :private)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}")
end
@azu
azu / amp.d.ts
Last active November 19, 2022 06:08
TypeScript definitions for AMP Attributes. Write AMP in JSX.
// roughish AMP attribute types for JSX/TypeScript
// Source: https://playground.amp.dev/amphtml-hint.json
// https://github.com/Microsoft/TypeScript/issues/15449
// https://stackoverflow.com/questions/50585952/typescript-and-google-amp-property-amp-img-does-not-exist-on-type-jsx-intrin
import * as React from 'react';
// why null ?
type _ANY = any;
type _ANYS = any;
declare module 'react' {
interface HTMLAttributes<T> {