Skip to content

Instantly share code, notes, and snippets.

View fdaciuk's full-sized avatar
🔥

Fernando Daciuk fdaciuk

🔥
View GitHub Profile
@addyosmani
addyosmani / bytecode.md
Last active May 28, 2022 22:40
Thoughts on precompiling JS bytecode for delivery through a server/CDN

Some quick thoughts on https://twitter.com/dan_abramov/status/884892244817346560. It's not ignorant at all to ask how browser vendors approach performance. On the V8 side we've discussed bytecode precompilation challenges a few times this year. Here's my recollection of where we stand on the idea:

JavaScript engines like V8 have to work on multiple architectures. Every version of V8 is different. The architectures we target are different. A precompiled bytecode solution would require a system (e.g the server or a CDN) to generate bytecode builds for every target architecture, every version of V8 supported and every version of the JavaScript libraries or bundles bytecode is being generated for. This is because we would need to make sure every user accessing a page using that bytecode can still get the final JS successfully executed.

Consider that if a cross-browser solution to this problem was desired, the above would need to be applied to JavaScriptCore, SpiderMonkey and Chakra as well. It would need to ca

@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active March 20, 2024 00:17
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@surma
surma / importPolyfill.js
Created May 6, 2017 17:17
Polyfill for dynamic module loading
_registry = {};
importPolyfill = path => {
if(!(path in _registry)) {
const entry = _registry[path] = {};
entry.promise = new Promise(resolve => entry.resolve = resolve);
document.head.appendChild(Object.assign(
document.createElement('script'),
{
type: 'module',
innerText: `import * as X from '${path}'; _registry['${path}'].resolve(X);`,
@csswizardry
csswizardry / README.md
Last active April 2, 2024 20:17
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@fdaciuk
fdaciuk / extract-all-text-plugin.js
Created March 20, 2017 17:58
Webpack extract text even when use dynamic import()
'use strict'
class ExtractText {
constructor (options) {
this.options = options
this.filterFunction = this.getFilterFunction(options)
this.emit = this.emit.bind(this)
}
getFilterFunction (options) {
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@developit
developit / hydra-alias.md
Last active February 27, 2020 01:54
Alias to invoke Chrome Canary w/ tracing, for IRHydra

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome:

@itod
itod / split_keyboards.md
Last active April 28, 2024 19:44
Every "split" mechanical keyboard currently being sold that I know of
@akfzambrana
akfzambrana / configuracoes.scss
Last active September 6, 2017 20:53
Configurações de projeto/framework
@charset 'UTF-8';
/// Mapa para configuração de cores
/// Modificadores:
/// lighter: cor
/// light: cor
/// base: cor
/// medium: cor
/// dark: cor
/// darker: cor
@felipenmoura
felipenmoura / navigator.vibrate-visualizer.js
Created October 14, 2016 21:43
Use this to visualize the vibration result from the navigator.vibrate api.
(function (){
const originalVibrate = navigator.vibrate;
navigator.vibrate = function(){
var timer = 0;
var _b = document.body || false;
var curToggleStatus = true;
var previousBodyBorder = _b.style.border || 'none';
function toggle (force) {