Skip to content

Instantly share code, notes, and snippets.

View dominikkaegi's full-sized avatar
🎯
Focusing

Dominik Kaegi dominikkaegi

🎯
Focusing
View GitHub Profile
@dominikkaegi
dominikkaegi / destructering.js
Last active February 14, 2020 22:36
An overview of destructing objects and arrays
// -----------------------------------------------------
// --------------- DESTRUCTERING ---------------
// -----------------------------------------------------
// ------- NON-NESTED ARRAYS ---------------
// Simple Destructering
function foo() {
return [1, 2, 3]
}
@dominikkaegi
dominikkaegi / Arrowfunction_Static_Binding.js
Last active February 21, 2019 11:36
This gist showcases the difference between the static binding of the `this context` with ES6 arrow functions and dynamic binding with declarative functions
// ES 6 Arrow Function vs Function
// showcases the difference between the static binding of the `this context`
// with ES 6 Arrow Function and dynamic binding with normal Functions
var obj = {
dynamicBinding() {
console.log('Dynamic Context: ', this)
window.setTimeout(function() {
console.log('T Dynamic Context: ', this),
0
PS1="🐑💨 \W doka$ "
# --------- GIT compleition ----------
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# --------------- PYTHON ---------------
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
@dominikkaegi
dominikkaegi / Bash_Port_Utilities
Last active February 23, 2019 15:03
Utilities function to find and kill a process on a port easily
# Implemented and tested on MacOS
# Add utilties to ~./bash_profile to make them usable in your terminal
# ------------------- PORT UTILTIES ----------------------
# Find PID of process on a specific port
# param portNumber
# example: "findPortProcess 8080"
findPortProcess() {
portProcess="$(lsof -n -i4TCP:$1 | grep LISTEN)"
if [ "$portProcess" ]
@dominikkaegi
dominikkaegi / eventloopQueuePrioritisation.js
Last active February 12, 2019 14:57
This gist showcases the prioritisation of the Microtask Queue over the Task Queue
/**
* Microtask Queue vs Task Queue
* Prioritisation between Microtask Queue (also named Job Queue) and Task Queue
*
* There are two queues for executing asynchronous javascript. The Micro Task queue has priority over the Task Queue.
* If you would keep on filling the micro task queue, you would block the code on the task queue.
* Asynchronous code which returns objects (like promises) are getting added to the Micro Task Queue.
* Asynchronous code which leave no trace (like setTimeout()) are getting added to the Task Queue.
*/
// A simple Bookmarklet which calculates the time you have worked at a given day
// 1. Go to https://zeitplan.hcweb.ch
// 2. Log in and select the day you want to evaluate
// 3. Click on the Bookmarklet you created with the code below
// To pulish, first minify / uglify it before you throw it into the book
// marklet create:
// 1. Uglify https://skalman.github.io/UglifyJS-online/
// 2. Bokkmarkify: https://mrcoles.com/bookmarklet/