Skip to content

Instantly share code, notes, and snippets.

View nothingbutboring's full-sized avatar

Edgaras Dambrauskas nothingbutboring

View GitHub Profile
@nothingbutboring
nothingbutboring / app.css
Created February 14, 2020 20:39
Image hover effect from black n white to color
body {
overflow: hidden;
margin: 0;
background: #222;
}
#main-img {
display: block;
margin: 20px auto;
border: 1px solid rgba(255,255,255,0.2);
@nothingbutboring
nothingbutboring / AppContext.js
Created February 10, 2020 10:11
Next.JS global state pattern
import { createContext } from 'react';
const AppContext = createContext({
appData: null,
});
export default AppContext;
@nothingbutboring
nothingbutboring / utf8-regex.js
Created May 9, 2017 08:20 — forked from chrisveness/utf8-regex.js
Utf8 string encode/decode using regular expressions
/**
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters
* (BMP / basic multilingual plane only).
*
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars.
*
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)),
* but this approach may be useful in other languages.
*
* @param {string} unicodeString - Unicode string to be encoded as UTF-8.