Skip to content

Instantly share code, notes, and snippets.

View romulomourao's full-sized avatar

Romulo Mourão romulomourao

View GitHub Profile
@mandado
mandado / callAll.ts
Last active November 17, 2022 15:58
interface CallBack<Params extends any[]> {
(...args: Params): void;
}
export const callAll =
<Params extends any[]>(...fns: Array<CallBack<Params> | undefined>) =>
(...args: Params) =>
fns.forEach((fn) => typeof fn === 'function' && fn(...args));
// use example <input onKeyDown={callAll(addTagOnEnterPress, removeLastTagOnBackspacePress)} />
@jsmithdev
jsmithdev / .xbindkeysrc
Created January 15, 2019 19:20
Logitech MX Master button map for Linux. Tab thru browser tabs with mouse.
# For the benefit of emacs users: -*- shell-script -*-
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.8.6
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active April 13, 2024 12:22
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@mrmartineau
mrmartineau / stimulus.md
Last active May 12, 2024 04:35
Stimulus cheatsheet
sudo apt install git
sudo apt install curl
sudo apt install vim
# rails essentials
sudo apt-get install openssh-server libxml2 libxml2-dev libxslt1-dev libmysqlclient-dev nodejs libqt4-dev libqtwebkit-dev -y
# alternativa para extrair arquivos zipados
sudo apt install dtrx
@amishshah
amishshah / har-extract.js
Created February 12, 2017 16:14
Rough script to extract images from HTTP Archive (HAR) files
const fs = require('fs');
const file = JSON.parse(fs.readFileSync('./dump.har')).log;
const targetMimeType = 'image/jpeg';
let count = 1;
for (const entry of file.entries) {
if (entry.response.content.mimeType === targetMimeType) {
// ensure output directory exists before running!
fs.writeFileSync(`output/${count}.png`, new Buffer(entry.response.content.text, 'base64'), 'binary');
count++;
@jesstelford
jesstelford / event-loop.md
Last active June 7, 2024 17:12
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@danielwrobert
danielwrobert / webpack.config.js
Last active February 1, 2022 10:18
Example Webpack Config File
const path = require( 'path' );
const webpack = require( 'webpack' );
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = ( env, options ) => {
return {
entry: './src/block.js',
output: {
path: path.resolve( __dirname, 'build' ),
@paulirish
paulirish / what-forces-layout.md
Last active July 7, 2024 16:21
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 6, 2024 04:11
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites