Originally from https://github.com/tomtomdu73/mixed-marvelous-mermaid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const HorizontalScroll = styled.div` | |
| position: relative; | |
| overflow: hidden; | |
| --offset: 20vw; | |
| --move-initial: calc(-25% + var(--offset)); | |
| --move-final: calc(-50% + var(--offset)); | |
| div { | |
| width: fit-content; | |
| display: flex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function readTextFile(file) { | |
| var rawFile = new XMLHttpRequest(); | |
| rawFile.open("GET", file, false); | |
| rawFile.onreadystatechange = function () { | |
| if(rawFile.readyState === 4) { | |
| if(rawFile.status === 200 || rawFile.status == 0) { | |
| var allText = rawFile.responseText; | |
| doSomethingWithTheText(allText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Tonejs Demo</title> | |
| </head> | |
| <body> | |
| <!-- Learn music theory https://www.youtube.com/watch?v=rgaTLrZGlk0 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Get Public Key</title> | |
| </head> | |
| <body> | |
| <div style="margin-bottom:5px">Enable Metamask, then click on the sign button and sign with your wallet to get your public key</div> | |
| <div style="margin-bottom:5px"><button onclick="enableMM()">Enable Metamask</button></div> | |
| <div style="margin-bottom:20px"><button onclick="findPublicKey()">Sign</button></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createDelegateBySigMessage = (compAddress, delegatee, expiry = 10e9, chainId = 1, nonce = 0) => { | |
| const types = { | |
| EIP712Domain: [ | |
| { name: 'name', type: 'string' }, | |
| { name: 'chainId', type: 'uint256' }, | |
| { name: 'verifyingContract', type: 'address' }, | |
| ], | |
| Delegation: [ | |
| { name: 'delegatee', type: 'address' }, | |
| { name: 'nonce', type: 'uint256' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.khanacademy.org/computing/computer-programming/programming-games-visualizations/memory-game/a/intro-to-memory | |
| var Tile = function(x, y, face) { | |
| this.x = x; | |
| this.y = y; | |
| this.size = 50; | |
| this.face = face; | |
| this.isFaceUp = false; | |
| this.isMatch = false; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require("crypto"); | |
| var algorithm = "aes-192-cbc"; //algorithm to use | |
| var password = "Hello darkness"; | |
| const key = crypto.scryptSync(password, 'salt', 24); //create key | |
| var text= "this is the text to be encrypted"; //text to be encrypted | |
| const iv = crypto.randomBytes(16); // generate different ciphertext everytime | |
| const cipher = crypto.createCipheriv(algorithm, key, iv); | |
| var encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex'); // encrypted text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
| # also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Adapted from: https://betterprogramming.pub/why-i-got-rid-of-getinitialprops-in-my-next-js-project-fc926e98ed61 | |
| export function authWrapper(next) { | |
| return async function auth(ctx) { | |
| const user = await session.getUser(); | |
| if (!user) { | |
| return { | |
| redirect: { | |
| destination: '/sign-in', |