Skip to content

Instantly share code, notes, and snippets.

Avatar

Erko Bridee erkobridee

View GitHub Profile
View mac_OS_check_stored_password.md
@erkobridee
erkobridee / react_hook_useWait.ts
Last active Apr 27, 2020
safe way to use setTimeout or setInterval through react hooks
View react_hook_useWait.ts
import * as React from 'react';
export enum JSTypeof {
UNDEFINED = 'undefined',
FUNCTION = 'function',
OBJECT = 'object',
STRING = 'string',
NUMBER = 'number',
}
View detect_location.js
/*
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 Jan 17, 2020
[gatsby testing] useful links #gastbyjs #js #testing
View gatsbyjs_ts-js_testing.md
@erkobridee
erkobridee / iframe-content.css
Last active Dec 2, 2019
set focus to an iframe after loads its content
View iframe-content.css
// hack to enable touch after focus on the iframe
html,
body {
touch-action: auto;
}
@erkobridee
erkobridee / google_chrome_notepad.md
Created Nov 8, 2019
Notepad (paste in Chrome's addressbar)
View google_chrome_notepad.md

past the following string into the google chrome address bar:

data:text/html,<html contenteditable>
@erkobridee
erkobridee / git_repo_backup.sh
Last active Jun 21, 2019
useful way to backup a whole repository from on remote to another remote server on an Unix base system
View git_repo_backup.sh
# 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
Created Apr 30, 2019
example of how to write a multiline RegExp and keep under row max length lint rules
View multiline_regexp_sample.js
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
a way to detect if a given element is on the visible area of the page
View isElementVisible.js
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;
}
@erkobridee
erkobridee / useWait.ts
Created Apr 24, 2019
react hook for safe use setInterval or setTimeout
View useWait.ts
import * as React from 'react';
export type TFunction = (...args: any[]) => any;
/**
* common code to define useTimeout or useInterval hooks
*
* @param waitFunction
* @param cleanWaitFunction
*/
You can’t perform that action at this time.