Skip to content

Instantly share code, notes, and snippets.

View MKruschke's full-sized avatar

Mirko Kruschke MKruschke

  • Adevinta
  • Berlin
View GitHub Profile
function useAbortController(deps=[]) {
const abortControllerRef = React.useRef<AbortController>()
React.useEffect(() => {
return () => abortControllerRef.current?.abort()
}, deps)
const getSignal = React.useCallback(() => {
if (!abortControllerRef.current) {
abortControllerRef.current = new AbortController()
@MKruschke
MKruschke / tmux.conf
Created May 15, 2017 13:55 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@MKruschke
MKruschke / in_viewport.js
Created November 9, 2016 22:47 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@MKruschke
MKruschke / launch.js
Created October 11, 2016 15:02 — forked from paambaati/launch.js
Debug mocha tests using Visual Studio Code
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Run app.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
@MKruschke
MKruschke / README.md
Created July 28, 2016 15:11 — forked from hofmannsven/README.md
My simply Git Cheatsheet