Skip to content

Instantly share code, notes, and snippets.

View dirkgroenen's full-sized avatar

Dirk Groenen dirkgroenen

View GitHub Profile
@dirkgroenen
dirkgroenen / inline-web-worker.ts
Created September 24, 2019 09:09
Just here for future reference, a (draft) inline web worker class.
/**
* Abstract class used to create and spwan inline workers.
*
* Workers can be created by extending the WebWorker class and creating
* your own implementation of 'perform()'. The extended class can then
* be used to spawn the new worker and communicate with it.
*
* @example
*
* class StorageWorker extends WebWorker {
@dirkgroenen
dirkgroenen / git-merge.sh
Created August 14, 2019 07:48
Merge multiple GIT repositories while keeping their history. Credits: https://stackoverflow.com/a/43345686
function git-add-repo
{
repo="$1"
branch="$3"
dir="$(echo "$2" | sed 's/\/$//')"
path="$(pwd)"
tmp="$(mktemp -d)"
remote="$(echo "$tmp" | sed 's/\///g'| sed 's/\./_/g')"
@dirkgroenen
dirkgroenen / db.rake
Created March 1, 2018 11:25 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@dirkgroenen
dirkgroenen / gist:07c3e8e4bc7e08bc3232ae0bdd6a0ba5
Last active July 8, 2023 05:13 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@dirkgroenen
dirkgroenen / RPI Search
Created May 18, 2016 10:45
Searches for a Raspberry PI in the network
@dirkgroenen
dirkgroenen / iehexconverter.js
Created October 22, 2014 09:19
Awesome little script that converts RGBa and HSLa to IE <9 supported CSS
/*
Namespace: IETranslucencyCalc
Converts modern CSS color values to IE filter versions.
File: ietranslucencycalc.js
About: Version
2.0.1
Description: