Skip to content

Instantly share code, notes, and snippets.

@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active April 14, 2024 04:25
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@xtuc
xtuc / Babel.md
Last active April 17, 2019 04:43

Path

remove

Removes the current path.

Example

Visistor:

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@avdg
avdg / es6.ebnf
Last active September 15, 2023 06:04
ES6 bnf grammer - See https://avdg.github.io/es6.xhtml
/* ebnf file for es 6 - MAY CONTAIN ERRORS / DISAMBIGUITY */
Grammer::= Statement
/* Lexical grammer */
SourceCharacter ::= #x0000-#x10FFFF
InputElementDiv ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | RightBracePunctuator
InputElementRegExp ::= WhiteSpace | LineTerminator | Comment | CommonToken | RightBracePunctuator | RegularExpressionLiteral
InputElementRegExpOrTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | RegularExpressionLiteral | TemplateSubstitutionTail
InputElementTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | TemplateSubstitutionTail
WhiteSpace ::= "<TAB>" | "<VT>" | "<FF>" | "<SP>" | "<NBSP>" | "<ZWNBSP>" | "<USP>"
@jaawerth
jaawerth / promise-series.js
Last active September 4, 2018 21:07
Run a list of functions in series, returning a pjromise that resolves to an array of results.
'use strict';
/*
* run promises in sequence, return an array of results.
* Returns a promise that resolves to an array of results, where funcs[i]() -> results[i]
*/
function asyncSeries(...funcs) {
return aggregate([], funcs);
}
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active March 29, 2024 19:56
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@rxaviers
rxaviers / gist:7360908
Last active April 25, 2024 04:56
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@WizKid
WizKid / gist:1170297
Created August 25, 2011 09:16
Remove comments in a JSON file
def removecomments(s):
inCommentSingle = False
inCommentMulti = False
inString = False
t = []
l = len(s)
i = 0
fromIndex = 0
@remy
remy / gist:339928
Created March 22, 2010 09:57
Easing functions for Emile
var easing = {
elastic: function(pos){return -1*Math.pow(4,-8*pos)*Math.sin((pos*6-1)*(2*Math.PI)/2)+1},
swingFromTo:function(pos){var s=1.70158;return((pos/=0.5)<1)?0.5*(pos*pos*(((s*=(1.525))+1)*pos-s)):0.5*((pos-=2)*pos*(((s*=(1.525))+1)*pos+s)+2)},
swingFrom:function(pos){var s=1.70158;return pos*pos*((s+1)*pos-s)},
swingTo:function(pos){var s=1.70158;return(pos-=1)*pos*((s+1)*pos+s)+1},
bounce:function(pos){if(pos<(1/2.75)){return(7.5625*pos*pos)}else{if(pos<(2/2.75)){return(7.5625*(pos-=(1.5/2.75))*pos+0.75)}else{if(pos<(2.5/2.75)){return(7.5625*(pos-=(2.25/2.75))*pos+0.9375)}else{return(7.5625*(pos-=(2.625/2.75))*pos+0.984375)}}}},
bouncePast:function(pos){if(pos<(1/2.75)){return(7.5625*pos*pos)}else{if(pos<(2/2.75)){return 2-(7.5625*(pos-=(1.5/2.75))*pos+0.75)}else{if(pos<(2.5/2.75)){return 2-(7.5625*(pos-=(2.25/2.75))*pos+0.9375)}else{return 2-(7.5625*(pos-=(2.625/2.75))*pos+0.984375)}}}},
easeFromTo:function(pos){if((pos/=0.5)<1){return 0.5*Math.pow(pos,4)}return -0.5*((pos-=2)*Math.po