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
| #!/bin/bash | |
| # File location: ~/bin/mosh-launcher.sh | |
| # --- Set the PATH for Homebrew --- | |
| eval "$(/opt/homebrew/bin/brew shellenv)" | |
| # --- Set the Locale for UTF-8 --- | |
| export LANG=en_US.UTF-8 | |
| export LC_ALL=en_US.UTF-8 | |
| # --- Execute the real mosh-server --- |
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
| import cors from 'cors'; | |
| import express from 'express'; | |
| import Session from 'express-session'; | |
| import { generateNonce, SiweMessage } from 'siwe'; | |
| const app = express(); | |
| app.use(express.json()); | |
| app.use(cors({ | |
| origin: 'http://localhost:8080', | |
| credentials: true, |
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 MAKER_ASSET: SwappableAsset = { | |
| type: 'ERC20', | |
| tokenAddress: DAI_TOKEN_ADDRESS_MUMBAI_TESTNET, | |
| amount: '1000000000', // 1 DAI | |
| }; | |
| const TAKER_ASSET: SwappableAsset = { | |
| type: 'ERC20', | |
| tokenAddress: WMATIC_TOKEN_ADDRESS_MUMBAI_TESTNET, | |
| amount: '1000000000', // 0.0000001 WMATIC | |
| }; |
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
| import { Web3Provider } from '@ethersproject/providers' | |
| const provider = new Web3Provider(window.ethereum) | |
| const [address] = await window.ethereum.request({ method: 'eth_accounts' }) | |
| const res = await fetch('https://api.0x.org/swap/v1/quote?buyAmount=1000000&buyToken=USDT&sellToken=USDC') | |
| const quote = await res.json() |
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
| /* eslint-disable */ | |
| import { RefObject, useEffect } from 'react'; | |
| import { useRafState } from 'react-use'; | |
| export interface State { | |
| x: number; | |
| y: number; | |
| totalHeight: number; | |
| } |
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
| import React, { Component } from 'react'; | |
| import { Experiment } from './experiment/Experiment'; | |
| import { Case } from './experiment/Case'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <Experiment> | |
| <Case when={(experimentMetadata) => experimentMetadata.foo === 'bar'}> |
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://en.wikipedia.org/wiki/Marzullo%27s_algorithm | |
| const calculateIntersectingRanges = (ranges: Array<[number, number, any?]>, userOptions = {}) => { | |
| let START = 1; | |
| let END = -1; | |
| let points: Array<{ | |
| value: number; | |
| rangeIndex: number; | |
| type: number; | |
| count?: number; | |
| index?: number; |
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
| class App extends Component { | |
| render() { | |
| return ( | |
| <FullscreenContainer> | |
| <TooltipManager> | |
| <Canvas> | |
| <div> | |
| I'm, like, always trying to save the planet? Here's my chance. I was part of something special. | |
| Checkmate... Life finds a way. |
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
| // Takes an array of objects and a property to 'pluck' or 'grab' | |
| // > pluck([{k1: 1, k2: 3}, {k1: 5, k2: 1}], 'k1') | |
| // > [1, 5] | |
| /* | |
| T = OBJECT a.k.a. ({ k1: val1, k2: val2}) | |
| K = property | |
| */ | |
| const pluck = <T, K extends keyof T>(objs: T[], key: K): T[K][] => { |
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 request = require('request'); | |
| // After getting access tokens... | |
| // Don't worry these aren't valid tokens... | |
| const oauth = { | |
| consumer_key: 'test', | |
| private_key: `-----BEGIN RSA PRIVATE KEY----- | |
| AoGBAKZ4sQJ8rglpGX02SdeMF570vKVXtxf6jhl5TveGYmRsSvFpB9Kexa26YMqn | |
| oPUBYTmITIsfWOXv/SG+fWrBUEDHqqREIzH6XsR6US5JCKZkwF5PpTRnYwIDAQAB | |
| -----END RSA PRIVATE KEY-----`, |
NewerOlder