Skip to content

Instantly share code, notes, and snippets.

View jankapunkt's full-sized avatar
🏠
Working from home

Jan Küster jankapunkt

🏠
Working from home
View GitHub Profile
@jankapunkt
jankapunkt / yt-hide-consent.js
Created September 10, 2020 11:40
Greasemonkey UserScript Youtube hide consent panel
@jankapunkt
jankapunkt / commit_updated_files.sh
Last active March 18, 2020 08:56
Update Meteor core + packages + npm outdated packages
#!/usr/bin/env bash
# Author: Jan Küster
# License: MIT
# Description:
# This optional script checks for the updated files related to
# the update script and commits their changes using some default messaged.
# -----------------------------------------------------------------------------
# Step 4: check for changed files and create respective commit messages
# -----------------------------------------------------------------------------
@jankapunkt
jankapunkt / init_add_origin.sh
Created August 19, 2019 04:58
Initializes a new repo and merges it with a new origin
#!/usr/bin/env bash
# init repo and initially add all files
# ignore should exist before already
git init
git add -A
git commit -a -m "initial files added"
# add the new remote and merge them
git remote add origin $1
@jankapunkt
jankapunkt / circular.js
Last active July 10, 2019 16:05 — forked from lukas-zech-software/circular.js
Detect circular references in objects
export const isCircular = target => {
const map = new WeakMap()
const detect = obj => {
if (obj === null || typeof obj !== 'object') return false
if (map.get(obj)) return true
map.set(obj, true)
return Object.values(obj).some(objProp => detect(objProp))
}
return detect(target)
}
@jankapunkt
jankapunkt / command.css
Last active January 18, 2019 10:11
Javascript command pattern example. Put this in your fiddle, code pen or other online editor and run it. Supports undo and redo.
body {
font-family: 'Helvetica', 'Arial', 'Sans Serif';
}
pre {
background-color: #ddd;
padding: 4px;
}
code {
@jankapunkt
jankapunkt / isObject.js
Last active January 24, 2018 14:20
Approach to get a full working isObject test in JavaScript
/**
* Returns true, if x is a pure Object (not a descendant of Object)
* Test cases:
* assert.isFalse(isObject(''));
* assert.isFalse(isObject('abc'));
* assert.isFalse(isObject([]));
* assert.isFalse(isObject([1,2,3]));
* assert.isFalse(isObject(1));
* assert.isFalse(isObject(1.4));
* assert.isFalse(isObject(function () {}));
@jankapunkt
jankapunkt / babel_build.js
Created March 3, 2017 15:58
Multiplatform babel build
/*
---------------------------------------------------------------------------
The MIT License
Copyright 2017 Jan Küster <info@jankuester.com>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,