Skip to content

Instantly share code, notes, and snippets.

View giammyisjammy's full-sized avatar
:atom:
I may be slow to respond.

Gianmarco giammyisjammy

:atom:
I may be slow to respond.
View GitHub Profile
@giammyisjammy
giammyisjammy / asyncPool.js
Created February 24, 2024 09:21 — forked from jzohrab/asyncPool.js
Javascript async pool - exec async functions in a pool of fixed sized
/** Async pool
* Originally seen at https://github.com/rxaviers/async-pool/blob/master/lib/es6.js
* Simplified thanks to u/GSLint in
* https://www.reddit.com/r/learnjavascript/comments/gebobv/cant_grok_asyncpool_es6_code/
*/
/** Run asyncFunction array, poolSize at a time. */
async function asyncPool (array, poolSize) {
const result = []
const pool = []
@giammyisjammy
giammyisjammy / .bashrc
Last active November 14, 2023 16:20 — forked from marioBonales/.bashrc
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

let po = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.log(entry);
}
});
po.observe({type: 'layout-shift', buffered: true});
let po2 = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
@giammyisjammy
giammyisjammy / README.md
Created April 29, 2021 07:46 — forked from rstacruz/README.md
CSS Blitz: Task List UI

Task List UI

View mockup · Start coding

Instructions

  • You have 15 minutes to implement this UI.
  • Text, colors, and other assets are provided for you.
@giammyisjammy
giammyisjammy / AngularRxJs5DateHttpInterceptor.ts
Created January 8, 2021 18:03 — forked from martinobordin/AngularRxJs5DateHttpInterceptor.ts
An Angular interceptor to parse string dates (ISO8601 format) from server response to JS Date Object. There are both RxJs 5 and RxJs 6 versions
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/do';
@Injectable()
export class AngularDateHttpInterceptor implements HttpInterceptor {
// Migrated from AngularJS https://raw.githubusercontent.com/Ins87/angular-date-interceptor/master/src/angular-date-interceptor.js
iso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/;
@giammyisjammy
giammyisjammy / script-template.sh
Created December 15, 2020 17:02 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]