Skip to content

Instantly share code, notes, and snippets.

View erkobridee's full-sized avatar

Erko Bridee erkobridee

View GitHub Profile
@erkobridee
erkobridee / react_hook_useWait.ts
Last active April 27, 2020 09:51
safe way to use setTimeout or setInterval through react hooks
import * as React from 'react';
export enum JSTypeof {
UNDEFINED = 'undefined',
FUNCTION = 'function',
OBJECT = 'object',
STRING = 'string',
NUMBER = 'number',
}
@erkobridee
erkobridee / detect_location.js
Created February 25, 2020 09:27
detect user location
/*
version updated to use the fetch API
source:
https://github.com/AdeyinkaAdegbenro/Detect_Location/blob/master/detect_location.js
*/
function request(url) {
return fetch(url).then(response => response.json());
}
@erkobridee
erkobridee / gatsbyjs_ts-js_testing.md
Last active January 17, 2020 10:07
[gatsby testing] useful links #gastbyjs #js #testing
@erkobridee
erkobridee / scrum_game.md
Last active July 8, 2022 10:48
scrum exercises

Scrum game

Estimation exercise ~ 2 h

iteration 1 - strawberries eating association - individually, no collaboration, estimate (charge and deadline) consume x000 strawberries - 3 minutes to decide

Discuss exceptions, differences, approaches … All estimations are correct. 
@erkobridee
erkobridee / iframe-content.css
Last active December 15, 2022 03:24
set focus to an iframe after loads its content
// hack to enable touch after focus on the iframe
html,
body {
touch-action: auto;
}
@erkobridee
erkobridee / google_chrome_notepad.md
Created November 8, 2019 07:22
Notepad (paste in Chrome's addressbar)

past the following string into the google chrome address bar:

data:text/html,<html contenteditable>
@erkobridee
erkobridee / git_repo_backup.sh
Last active July 4, 2023 07:38
useful way to backup a whole repository from on remote to another remote server on an Unix base system
# define a full backup of a git repository from one remote server to another one
origin="https://remote-source/repository.git";
target="https://remote-target/repository.git";
workDir="temp-directory";
mkdir $workDir
@erkobridee
erkobridee / multiline_regexp_sample.js
Last active November 10, 2021 16:57
example of how to write a multiline RegExp and keep under row max length lint rules
const DEVICES_REGEXP = new RegExp([
/Android|webOS/,
/|iPhone|iPad|iPod/,
/|BB10|BlackBerry/,
/|IEMobile|Opera Mini/,
/|Mobile|mobile/
].map(function(r) {return r.source}).join(''), 'i');
// output: /Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i
@erkobridee
erkobridee / isElementVisible.js
Last active May 6, 2019 06:47
a way to detect if a given element is on the visible area of the page
function isElementVisible(el, fullVisible) {
// efp - element from point
function efp(x, y) {
return window.document.elementFromPoint(x, y);
}
function getVWidth() {
return window.innerWidth || window.document.documentElement.clientWidth;
}