Skip to content

Instantly share code, notes, and snippets.

@Klerith
Klerith / Instalaciones-React.md
Last active May 6, 2024 03:28
Instalaciones recomendadas para mi curso de React de cero a experto
// my problem: (with a bit of handwaving here — imagine that each step is
// _actually_ async)
function doAThing() {
return new Promise(resolve => { // A
setTimeout(resolve, 100, Math.random())
}).then(randomNum => { // B (derived from A's result)
return randomNum * Math.random()
}).then(superRandomNumber => { // C
return superRandomNumber * originalRandomNumber
// where "originalRandomNumber" === "randomNum" from A
{
"uri": "https://slick.app",
"schemas": {
"invite": "https://slick.app/schemas/invite",
"community": "https://slick.app/schemas/community",
"details": "https://slick.app/schemas/details",
"channel": "https://slick.app/schemas/channel",
"message": "https://slick.app/schemas/message",
"reaction": "https://slick.app/schemas/reaction",
"admin": "https://slick.app/schemas/admin",
@mpgn
mpgn / SubtleCrypto.js
Last active May 6, 2024 03:25
SubtleCrypto javascript example
// exemple based on https://github.com/diafygi/webcrypto-examples#rsa-oaep
function importKey() {
return window.crypto.subtle.importKey(
"jwk", //can be "jwk" or "raw"
{ //this is an example jwk key, "raw" would be an ArrayBuffer
kty: "oct",
k: "Y0zt37HgOx-BY7SQjYVmrqhPkO44Ii2Jcb9yydUDPfE",
alg: "A256GCM",
ext: true,
@Bagniz
Bagniz / Web Development Resources.md
Last active May 6, 2024 03:25
This is a GitHub gist containing some useful links for web development resources a web developer may need.
// Here is a proposal for minimalist JavaScript classes, humbly offered.
// There are (at least) two different directions in which classes can be steered.
// If we go for a wholly new semantics and implementation, then fancier classical
// inheritance can be supported with parallel prototype chains for true inheritance
// of properties at both the class and instance level.
// If however, we keep current JavaScript prototype semantics, and add a form that
// can desugar to ES3, things must necessarily stay simpler. This is the direction
// I'm assuming here.
@BrendanEich
BrendanEich / minimalist-classes.js
Created November 1, 2011 22:48 — forked from jashkenas/minimalist-classes.js
less minimalism, richer leather
// A response to jashkenas's fine proposal for minimalist JavaScript classes.
// Harmony always stipulated classes as sugar, so indeed we are keeping current
// JavaScript prototype semantics, and classes would only add a syntactic form
// that can desugar to ES5. This is mostly the same assumption that Jeremy
// chose, but I've stipulated ES5 and used a few accepted ES.next extensions.
// Where I part company is on reusing the object literal. It is not the syntax
// most classy programmers expect, coming from other languages. It has annoying
// and alien overhead, namely colons and commas. For JS community members who
@jhusain
jhusain / Response
Created August 19, 2015 18:19
Games JSON Graph
//You shouldn't find your self asking for ids from a Falcor JSON Graph object.
//it seems like you want to build an array of game ids:
{
games: [
{ $type: "ref", value: ["gamesById", 352] },
{ $type: "ref", value: ["gamesById", 428] }
// ...
],
var spec = { enumerable: false }
var x = {};
Object.defineProperty(x, "test", spec);
x.test = "what"
alert(JSON.stringify(x));
var y = {};
Object.defineProperty(y, "test", spec);
@jhusain
jhusain / PEG grammer for pattern match syntax
Created October 29, 2016 03:29
PEG grammer for pattern match syntax. Forked from JSON grammer.
JSON_text
= ws value:value ws { return value; }
begin_array = ws "[" ws
begin_object = ws "{" ws
end_array = ws "]" ws
end_object = ws "}" ws
name_separator = ws ":" ws
value_separator = ws "," ws