Skip to content

Instantly share code, notes, and snippets.

View cristianp6's full-sized avatar

Cristian Pascottini cristianp6

View GitHub Profile
@WebReflection
WebReflection / esx.md
Last active May 6, 2024 08:49
Proposal: an ESX for JS implementation
@WebReflection
WebReflection / dom-libraries.md
Last active February 6, 2024 15:50
A recap of my FE / DOM related libraries

My FE/DOM Libraries

a gist to recap the current status, also available as library picker!

Minimalistic Libraries

do one thing only and do it well

  • µhtml (HTML/SVG auto-keyed and manual keyed render)
  • augmentor (hooks for anything)
  • wickedElements (custom elements without custom elements ... wait, what?)
@WebReflection
WebReflection / custom-elements-pattern.md
Last active May 17, 2024 23:30
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.

@OliverJAsh
OliverJAsh / foo.ts
Last active June 27, 2018 02:23
Type safe routing with `fp-ts-routing` and `unionize`
import {
end,
int,
lit,
Match,
parse,
Route as RouteBase,
zero
} from "fp-ts-routing";
import { pipe } from "fp-ts/lib/function";
@ankurk91
ankurk91 / 1-elementary-os-apps.md
Last active December 25, 2023 19:14
elementary OS 5.1 Hera

elementaryOS Apps and Configs

⚠️ No longer maintained! ⚠️

This guide has been updated for elementaryOS v5.0+.

Enbale PPA support

sudo apt-get update
sudo apt-get -y install software-properties-common
@ChrisChares
ChrisChares / AsyncAwaitGenerator.md
Last active September 30, 2022 13:26
async/await with ES6 Generators & Promises

async/await with ES6 Generators & Promises

This vanilla ES6 function async allows code to yield (i.e. await) the asynchronous result of any Promise within. The usage is almost identical to ES7's async/await keywords.

async/await control flow is promising because it allows the programmer to reason linearly about complex asynchronous code. It also has the benefit of unifying traditionally disparate synchronous and asynchronous error handling code into one try/catch block.

This is expository code for the purpose of learning ES6. It is not 100% robust. If you want to use this style of code in the real world you might want to explore a well-tested library like co, task.js or use async/await with Babel. Also take a look at the official async/await draft section on desugaring.

Compatibility

  • node.js - 4.3.2+ (maybe earlier with
@ljharb
ljharb / array_iteration_thoughts.md
Last active May 22, 2024 09:22
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@azizur
azizur / Creating a static copy of a dynamic website.md
Last active April 27, 2024 06:08
Creating a static copy of a dynamic website

The command line, in short…

wget -k -K -E -r -l 10 -p -N -F --restrict-file-names=windows -nH http://website.com/

…and the options explained

  • -k : convert links to relative
  • -K : keep an original versions of files without the conversions made by wget
  • -E : rename html files to .html (if they don’t already have an htm(l) extension)
  • -r : recursive… of course we want to make a recursive copy
  • -l 10 : the maximum level of recursion. if you have a really big website you may need to put a higher number, but 10 levels should be enough.
@PaulKinlan
PaulKinlan / bookmark.js
Last active June 27, 2016 05:03
Progressive Web App Checklist
(function() {
var ManifestParser = (function() {
'use strict';
var _jsonInput = {};
var _manifest = {};
var _logs = [];
var _tips = [];
var _success = true;
@cristianp6
cristianp6 / postgresql_changes_tracking.sql
Last active August 9, 2022 04:28
Log row changes in PostgreSQL - Any advice/improvement is welcome ;-)
/**
* Creates a "logging" schema with an "history" table where are stored records in JSON format
*
* Requires PostgreSQL >= 9.3 since data is stored in JSON format
*
* Credits: http://www.cybertec.at/2013/12/tracking-changes-in-postgresql/
*/
/* Create a schema dedicated to logs */
CREATE SCHEMA logging;