I hereby claim:
- I am scsskid on github.
- I am scsskid (https://keybase.io/scsskid) on keybase.
- I have a public key ASCcp5anr3F3NE5NpFCCBxsrWTiLEN71zRCdc5QVXas0Wwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/* | |
# Only connect to this site and subdomains via HTTPS for the next one year | |
Strict-Transport-Security: max-age=31536000; includeSubDomains | |
# Block site from being framed with X-Frame-Options and CSP | |
Content-Security-Policy: frame-ancestors 'self' | |
# X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking. | |
X-Frame-Options: SAMEORIGIN |
// Elegant Composition | |
const UnorderedList = ({children}) => ( | |
<ul> | |
{ | |
children.map((child, i) => <li key={i}>{child}</li> | |
} | |
</ul> | |
) | |
const App = () => ( |
function useLocalStorageState( | |
key, | |
defaultValue = '', | |
{ serialize = JSON.stringify, deserialize = JSON.parse } = {} | |
) { | |
const [state, setState] = React.useState(() => { | |
const valueInLocalStorage = window.localStorage.getItem(key); | |
if (valueInLocalStorage) { | |
return deserialize(valueInLocalStorage); |
function appHeight() { | |
document.documentElement.style.setProperty( | |
'--vh', | |
window.innerHeight * 0.01 + 'px' | |
); | |
} | |
React.useEffect(() => { | |
// window.addEventListener('resize', appHeight); | |
// appHeight(); |
function parseFormData(formData) { | |
const formEntries = new FormData(formData).entries(); | |
const data = {}; | |
for (var [formElementName, value] of formEntries) { | |
data[formElementName] = value; | |
} | |
return data; | |
} |
const events = new Map(); | |
class EventBus { | |
/** | |
* Register an event handler for the given type. | |
* | |
* @param {String} type Type of event to listen for. | |
* @param {Function} handler Function to call in response to given event. | |
*/ | |
on(type, handler) { |
sudo pkill -9 -u user |
function NumberFormatter(locale, opts) { | |
var formatNumber, | |
defaults = { | |
style: 'currency', | |
currency: 'EUR' | |
}; | |
opts = opts || {}; | |
opts = Object.assign({}, defaults, opts); | |
formatNumber = new Intl.NumberFormat(locale, opts); |