Skip to content

Instantly share code, notes, and snippets.

View nucliweb's full-sized avatar

Joan León nucliweb

View GitHub Profile
@krisselden
krisselden / trace-to-mp4.js
Last active April 6, 2025 09:18
Make an mp4 out of a Chrome DevTools trace with screenshots.
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
const FPS = 60;
const MICROSEC_PER_FRAME = Math.round(1000000 / FPS);
if (process.argv.length < 3) {
console.log(`node ${path.relative('.', process.argv[1])} [DevToolsProfile]`);
process.exit(1);
}
let traceFile = path.resolve(process.argv[2]);
@paulirish
paulirish / server-timing-demo.js
Last active August 7, 2024 16:56
Demo of server timing values. visualized in chrome devtools
// see for screenshot:
// https://twitter.com/paul_irish/status/829090506084749312
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
sql-1;desc="MySQL lookup Server";dur=100,
sql-2;dur=900;desc="MySQL shard Server #1",
@macbookandrew
macbookandrew / findStyles.js
Last active February 16, 2025 03:00
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@carlosvillu
carlosvillu / webpack.hjs.js
Created August 4, 2016 08:49
La configuración de webpack definitiva
const webpack = require('webpack')
const getConfig = require('hjs-webpack')
const isDev = (process.env.NODE_ENV || 'development') === 'development'
const isProd = !isDev && process.env.NODE_ENV === 'production'
const PRO_PUBLIC_PATH = ''
const DEV_PUBLIC_PATH = ''
const PUBLIC_PATH = isProd ? PRO_PUBLIC_PATH : DEV_PUBLIC_PATH
const GA_ID = 'UA-XXXXX-Y'
@sandeepraju
sandeepraju / ttfb.sh
Created July 20, 2016 21:17
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@droom
droom / Resource Hints
Last active September 26, 2021 00:35
Hints to the browser that might prime the pump for resources you will need. PreLoad is the only exception here, being more of an instruction than just a hint.
by Addy Osmani (@addyosmani)
https://twitter.com/addyosmani/status/743571393174872064
———
Preresolve DNS hostnames for assets
<link rel="dns-prefetch" href="https://my-site.com">
Begin a connection handshake in the background
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@tsulej
tsulej / nlinesvfield.pde
Created April 29, 2016 19:42
Nonintersecting lines vector field drawing
// generateme.tumblr.com, 2016
// idea by zach lieberman
// choose variant
int variant = 0; // 0 or 1;
void setup() {
size(800, 800);
background(0, 5, 25);
strokeWeight(0.8);
@ingramchen
ingramchen / gist:e2af352bf8b40bb88890fba4f47eccd0
Created April 5, 2016 12:58
ffmpeg convert gif to mp4, for best cross browser compatibility
### Full command line options
```
ffmpeg -f gif -i FOO.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' BAR.mp4
```
### Notie
* output mp4 is encoded with h264, support Firefox/Chrome/Safari in Windows, Mac OSX, Android, and iOS.
@carlosvillu
carlosvillu / cookie-parser.js
Last active December 28, 2015 10:27
Utility to work with cookies
@carlosvillu
carlosvillu / download.js
Last active December 22, 2015 22:58
Download Wallpapers from Blizzard
const range = require('lodash.range');
const flatten = require('flatten');
const Promise = require('bluebird');
const fs = require('fs');
const RANGE = 60;
const RESOLUTIONS = ['1440x900','1600x900'];
const STATUS_OK = 200;
const ENCODING_FILE = 'binary';