Skip to content

Instantly share code, notes, and snippets.

View grkblood13's full-sized avatar

grkblood13 grkblood13

View GitHub Profile
@jianwu
jianwu / static_server.js
Last active February 9, 2023 22:38 — forked from ryanflorence/static_server.js
Node.JS static file web server, also provides CORSProxy, Http/Https proxy function. Put it in your path to fire up servers in any directory, takes an optional port argument. If provide second https port argument, it will also start https. For https to work, need to put key and cert file in the folder.
#!/usr/bin/env node
const { argv } = require('process');
/**
Static http server implemented with NodeJS.
Features:
1. No external dependencies
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@sphaero
sphaero / gstreamer-build.sh
Last active February 11, 2023 16:25
Install & build gstreamer from git
#!/bin/bash --debugger
set -e
BRANCH="master"
if grep -q BCM2708 /proc/cpuinfo; then
echo "RPI BUILD!"
RPI="1"
fi
[ -n "$1" ] && BRANCH=$1
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;