curl --location 'https://id.twitch.tv/oauth2/token' \
--form 'client_id="{{twitch-client-id}}"' \
--form 'scope="{{twitch-scopes}}"' \
--form 'device_code="{{TWITCH_DEVICE_CODE}}"' \
--form 'grant_type="urn:ietf:params:oauth:grant-type:device_code"'
Set the variables twitch-client-id
and witch-client-secret
as secret variables in your Postman environment,
curl --location 'https://id.twitch.tv/oauth2/token' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "{{twitch-client-id}}",
"client_secret": "{{twitch-client-secret}}",
"grant_type": "client_credentials",
"scope": "the scopes you need"
}'
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 obsConfig = { | |
address: '127.0.0.1', | |
port: 4455, | |
password: 'your-password' | |
} | |
const socket = new WebSocket(`ws://${obsConfig.address}:${obsConfig.port}`); | |
const password = obsConfig.password; | |
socket.onopen = function(event) { |
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
/** | |
* @param {string[]} filePaths - Array of file paths to append to the document | |
* @returns {Promise<void>} - Promise that resolves when all files have been appended | |
* @usage appendScriptFilesToDocument(['script.js', 'style.css']) | |
*/ | |
const appendScriptFilesToDocument = (filePaths) => { | |
return new Promise((resolve, reject) => { | |
let count = 0; | |
const total = filePaths.length; |
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
:root { | |
--shadow-light: 150, 150, 150; | |
--shadow-dark: 0, 0, 0; | |
--shadow: var(--shadow-light); | |
--gray-50: 250, 250, 250; | |
--gray-100: 245, 245, 245; | |
--gray-200: 229, 229, 229; | |
--gray-300: 212, 212, 212; | |
--gray-400: 163, 163, 163; | |
--gray-500: 115, 115, 115; |
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
export const byte2Hex = (n: number): string => { | |
const nybHexString = '0123456789ABCDEF'; | |
return String(nybHexString.substr((n >> 4) & 0x0f, 1)) + nybHexString.substr(n & 0x0f, 1); | |
}; | |
export const RGBString2hex = (string: string): string => { | |
const newString: number[] = string | |
.replace('rgb(', '') | |
.replace(')', '') | |
.split(',') |
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 matchPercentage = (strA, strB) => { | |
let result = 0; | |
for (let i = strA.length; (i -= 1);) { | |
if (typeof strB[i] == 'undefined' || strA[i] == strB[i]) { | |
// | |
} else if (strA[i].toLowerCase() == strB[i].toLowerCase()) { | |
result += 1; | |
} else { | |
result += 4; | |
} |
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
export const checkDbLock = async () => { | |
const { confDb } = require('./config'); | |
try { | |
await confDb.$queryRaw`BEGIN EXCLUSIVE;`; | |
await confDb.$queryRaw`COMMIT;`; | |
return false; | |
} catch (error) { | |
return true; | |
} | |
}; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="icon" type="image/svg+xml" href="/favicon.ico" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>NoMercyPlayer API</title> | |
<script src="./dist/app.js?v=kw4n5l2n45" defer></script> |
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
humanTime (time: string | number) { | |
time = parseInt(time as string, 10); | |
let days: any = parseInt(`${(time / (3600 * 24))}`, 10); | |
let hours: any = this.pad(parseInt(`${(time % 86400) / 3600}`, 10), 2); | |
let minutes: any = parseInt(`${(time % 3600) / 60}`, 10); | |
let seconds: any = parseInt(`${time % 60}`, 10); | |
if (`${minutes}`.length === 1) { | |
minutes = `0${minutes}`; |
NewerOlder