Skip to content

Instantly share code, notes, and snippets.

@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@jmshal
jmshal / coverage.js
Created February 26, 2018 21:41 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
@jmshal
jmshal / atob.js
Last active April 27, 2024 04:12
Node.js ponyfill for atob and btoa encoding functions
module.exports = function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@bellbind
bellbind / main.js
Last active April 27, 2024 04:12
[electron] Tray launcher example
"use strict";
// [run the app]
// $ npm install electron
// $ ./node_modules/.bin/electron .
const {app, nativeImage, Tray, Menu, BrowserWindow} = require("electron");
let top = {}; // prevent gc to keep windows
@sylvaindethier
sylvaindethier / server.js
Created June 26, 2017 09:36
NodeJS Express server for SPA
// Express
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const PORT = 9000;
const STATIC = path.resolve(__dirname, 'dist');
const INDEX = path.resolve(STATIC, 'index.html');
@Saccarab
Saccarab / merge-ffmpeg.js
Created June 9, 2019 08:54
fluent-ffmpeg merge audio with video
const command = ffmpeg()
const commandArray = []
command.addInput(`./best.mp4`)
command.addInput(`./best2.wav`)
commandArray.push(`[1]volume=0.1[a1]`)
command.addInput(`./voiceover.mp3`)
commandArray.push(`[2]volume=0.9[a2]`)
let ffmpegKeys = '[a1][a2]amix=inputs=2[a]'
commandArray.push(ffmpegKeys)
@luciopaiva
luciopaiva / _Full-socketio-client-and-server-example.md
Last active April 27, 2024 04:09
Full socket.io client and server example

Full socket.io client and server example

Last updated: 2021-02-21, tested with socket.io v3.1.1

This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

If you're looking for examples using frameworks, check these links:

@claytonrcarter
claytonrcarter / README.md
Last active April 27, 2024 04:09
Bash script to check GitLab pipeline status

A super simple bash script to check the status of a GitLab CI pipeline.

$ git push
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"pending"
...
$ git pipeline-status
@Strykar
Strykar / myweechat.md
Last active April 27, 2024 04:09 — forked from pascalpoitras/config.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

Add 4 pane layout

/window merge all
/eval /window splith ${calc:8 / ${window[gui_current_window].win_height} * 100 // 1}
/buffer add -switch highmon
/window splitv 40
/buffer ##news
/window splitv 75

/buffer exec.conky