Skip to content

Instantly share code, notes, and snippets.

View madrus's full-sized avatar

Andre Roussakoff madrus

View GitHub Profile
@madrus
madrus / History|-100507ec|entries.json
Created October 29, 2022 10:34
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/madrus/src/aax-aanbodbeheer/src/i18n/i18n.ts","entries":[{"id":"QmiN.ts","timestamp":1659026721889},{"id":"B8ov.ts","timestamp":1659026903923},{"id":"bSVy.ts","timestamp":1659094168578},{"id":"dD6c.ts","source":"Add 'Namespace' to existing import declaration from \"react-i18next\"","timestamp":1659094211010},{"id":"RNeK.ts","timestamp":1659094275190},{"id":"zraD.ts","timestamp":1659094752294},{"id":"zlcZ.ts","timestamp":1659094871833},{"id":"1Bhg.ts","timestamp":1659096049962},{"id":"cOyg.ts","timestamp":1659096094923},{"id":"Hdt9.ts","timestamp":1659096296555},{"id":"jwIK.ts","timestamp":1659444716359},{"id":"Dq8o.ts","timestamp":1659450431000},{"id":"IPbD.ts","timestamp":1662047079331}]}
@madrus
madrus / mock_http_server.md
Last active August 20, 2022 13:20
Mock HTTP Server

Taken from cube.js

/* globals jest */
/* eslint-disable no-underscore-dangle */

const http = jest.requireActual('http');

http.__mockServer = {
 listen: jest.fn((opts, cb) => cb && cb(null)),
@madrus
madrus / mock_https_server.md
Last active August 20, 2022 13:15
Mock HTTPS Server

Taken from cube.js

/* globals jest */
/* eslint-disable no-underscore-dangle */

const https = jest.requireActual('https');

https.__mockServer = {
@madrus
madrus / Colored console.log
Created June 11, 2022 18:21
Tired of black text in DevTools console window? Try my functions.
const logBlue = (text: string) =>
console.log(`%c${text}\n`, 'color: blue; font-weight: 700')
const logRed = (text: string) =>
console.log(`%c${text}\n`, 'color: red; font-weight: 700')
const logGreen = (text: string) =>
console.log(`%c${text}\n`, 'color: green; font-weight: 700')
@madrus
madrus / tasks.json
Created May 16, 2022 05:34
Tasks: set node and npm versions via nvm
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "NVM: set Node and NPM versions",
"type": "shell",
"command": "nvm use 14",
"windows": {
@madrus
madrus / useOnlineStatus.tsx
Last active May 10, 2022 07:40
React: a React hook found on Internet to show the online&offline status of your app
import { FC, useState, useEffect, useContext, createContext, ReactElement } from 'react'
const OnlineStateContext = createContext<boolean>(true)
export const OnlineStateProvider: FC = ({ children }): ReactElement => {
const [onlineState, setOnlineState] = useState<boolean>(true)
useEffect(() => {
window.addEventListener('offline', () => {
setOnlineState(false)