I hereby claim:
- I am danew on github.
- I am daneo (https://keybase.io/daneo) on keybase.
- I have a public key ASCKVoT9q0qq3_xB5kbMietw0twxS6yt0dVDPFFkAk7aDwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python | |
import base64 | |
from Crypto.Hash import HMAC, SHA256 | |
class PasswordEncoder: | |
def encode(self, secret): | |
signature = self._hmac_sha256(b'SendRawEmail', secret) | |
byte_array = self._version_signature(signature) | |
return self._base64_encode(byte_array) |
module.exports = new Proxy({}, { get: () => 'cssMock' }); |
class Mastermind { | |
constructor() { | |
this.answer = []; | |
this.blocks = [ | |
'green', | |
'red', | |
'blue', | |
'yellow', | |
]; | |
} |
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_3_%E2%80%93_rewrite_the_DOMs_atob()_and_btoa()_using_JavaScript's_TypedArrays_and_UTF-8 | |
const base64 = require('base64-js'); | |
const urlSafe = (buffer) => { | |
const bytes = new Uint8Array(buffer); | |
return base64.fromByteArray(bytes) | |
.replace(/\+/g, '-') | |
.replace(/\//g, '_') | |
.replace(/=/g, ''); | |
}; |
import axios from 'axios'; | |
let active = true; | |
const save = (message, level = 'info') => { | |
if (process.env.NODE_ENV !== 'production') { | |
if (active) { | |
axios.post('http://localhost:9999/log', { level, message }).catch(() => { | |
active = false; | |
}); |
window.log = function(category, ...attr) { | |
const str = `%c* %c${category} %c[%c ${attr.join(', ')} %c]`; | |
console.log( | |
str, | |
'color:white', | |
'color:red; font-weight:bold', | |
'font-weight:bold', | |
'color:blue', | |
'font-weight:bold' | |
); |
This is a simple script to run a few performance audits with Chrome's Lighthouse audit tool to help verify if you are making any performance improvements while coding.
It will print out an audit if it is outside of the given threshold; in green if it's improved or red if it hasn't.
Run npm i -D lighthouse pretty-ms chalk
Run node test
#!/bin/bash | |
FILE_LIST=$(git diff --staged --diff-filter=ACMTUXB --name-only | grep -E \\.[tj]sx?$) | |
if [ -z "$FILE_LIST" ]; then | |
echo "Nothing to lint" | |
exit 0 | |
fi | |
if ! npx eslint --fix --max-warnings 0 $FILE_LIST; then |
import { EventEmitter } from 'node:events'; | |
const channels: Map<string, EventEmitter> = new Map(); | |
class MockBroadcastChannel implements BroadcastChannel { | |
private emitter: EventEmitter; | |
constructor(public name: string) { | |
if (channels.has(name)) { | |
this.emitter = channels.get(name); |