This file contains 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 camelEdges: RegExp = /([A-Z](?=[A-Z][a-z])|[^A-Z](?=[A-Z])|[a-zA-Z](?=[^a-zA-Z]))/g; | |
// Input Array consisting of codes starting with "WS_Something_" | |
const inputArray: string[] = [ | |
"WS_BLDNGMGMT_CertificationUpdateFailed", | |
"WS_USRMGMT_CompanyNotFound", | |
"WS_GEN_UnauthorizedOperation", | |
]; |
This file contains 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
let inputObject: {[key: string]: string} = { | |
"ServerError": "Could not connect. Try again", | |
"WS_BLDNGMGMT_AssignOpportunitiesFailure": "Assignment Failed", | |
"WS_GEN_GenericError": "Some Error Occurred", | |
"WS_SCRCRDMGMT_CriteriaCodeAlreadySelected": "Criteria with same Criteria Code already Selected", | |
}; | |
let sortedKeys: string[] = Object.keys(inputObject).sort((a,b) => a.localeCompare(b)); | |
let resultObject: {[key: string]: string} = {}; |
This file contains 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
console.clear(); | |
const carrierArray = [ | |
"T-Mobile - 3G *(US)*", | |
"T-Mobile - 4G *(US)*", | |
"Verizon Wireless - 3G *(US)*", | |
"Verizon Wireless - 4G *(US)*", | |
"Sprint - 3G *(US)*", | |
"Sprint - 4G *(US)*", | |
"AT&T - 3G *(US)*", |
This file contains 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
//Sorting Hex Color: | |
class Color { | |
hex: string; | |
constructor(hexVal: string) { | |
//define a Color class for the color objects | |
this.hex = hexVal; | |
}; |
This file contains 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 | |
PARAMS=('-m 6 -q 70 -mt -af -progress') | |
if [ $# -ne 0 ]; then | |
PARAMS=$@; | |
fi | |
cd $(pwd) |
This file contains 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
# Install Postgres if not exists | |
which psql | |
if [ "$?" -ne 0 ] | |
then | |
echo "Installing Postgres..." | |
sudo apt-get install postgresql --yes | |
echo "Altering password for user 'postgres'" | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'password';" | |
else |
This file contains 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
// .../api-data/data/createPokeData.js | |
import { readdirSync, readFileSync, writeFileSync } from 'fs'; | |
import { dirname, join } from 'path'; | |
import { fileURLToPath } from 'url'; | |
const baseDir = dirname(fileURLToPath(import.meta.url)); | |
const pokemonDir = join(baseDir, 'api', 'v2', 'pokemon'); | |
const outDir = join(baseDir, 'out'); |
This file contains 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
let input = [{ | |
"id": "REPORT1", | |
"application": "APP1", | |
"type": "TYPE1", | |
"title": "" | |
}, | |
{ | |
"id": "REPORT2", | |
"application": "APP1", | |
"type": "TYPE1", |
This file contains 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 pool = 151; // use the pool of your choice: 151 for Gen-1, etc. | |
const showName = false; // determines if the name of the Pokemon should be displayed or not | |
// Get data | |
const apiRequest = new Request( | |
`https://pokeapi.deno.dev/pokemon/potd?pool=${pool}` | |
); | |
const pokemon = await apiRequest.loadJSON(); | |
const imageRequest = new Request(pokemon.imageUrl); | |
const image = await imageRequest.loadImage(); |
This file contains 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
// Tick structure reference: https://kite.trade/docs/connect/v3/websocket/#message-structure | |
const parseBinary = (dataView: DataView) => { | |
const numberOfPackets = dataView.getInt16(0); | |
let index = 4; | |
const ticks: { token: number; firstBid: number; firstAsk: number }[] = []; | |
for (let i = 0; i < numberOfPackets; i++) { | |
const size = dataView.getInt16(index - 2); | |
// Parse whatever you need |
OlderNewer