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 emitExit(signal: string) { | |
| const exitCode = 0; | |
| console.log(`Received "${signal}" signal. Will terminate with exit code "${exitCode}".`); | |
| process.exit(exitCode); | |
| } | |
| // Catches Ctrl + C events | |
| process.on('SIGINT', () => emitExit('SIGINT')); | |
| // Catches "kill pid" events (for example: nodemon restarts) |
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 a: object = { name: 'Benny' }; | |
| const b: Object = { name: 'Benny' }; | |
| const c: {} = { name: 'Benny' }; | |
| const d: Record<string, string> = { name: 'Benny' }; | |
| const e: any = { name: 'Benny' }; | |
| const f: {[index: string]: string} = { name: 'Benny' }; |
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 test = { | |
| tree: { | |
| branch1: 10, | |
| branch2: 20, | |
| } | |
| }; | |
| const copies = {}; | |
| for (let i = 0; i < 10; i++) { |
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 Hawk = require('@hapi/hawk'); | |
| const request = require('request'); | |
| const API_KEY = 'KEY'; | |
| const API_KEY_ID = 'ID'; | |
| const credentials = { | |
| id: API_KEY_ID, | |
| key: API_KEY, | |
| algorithm: 'sha256' |
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
| // Compliant Promise/A+ implementation: https://www.promisejs.org/implementing/ | |
| // Alternative implementation: https://dexie.org/docs/Promise/Promise | |
| // Checkout the Node.js Event Loop: https://www.youtube.com/watch?v=PNa9OMajw9w | |
| // Bluebird breaking change: http://bluebirdjs.com/docs/new-in-bluebird-3.html#cancellation-overhaul | |
| const Promise = require('bluebird'); | |
| Promise.config({ | |
| cancellation: 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
| import {createServer} from 'http'; | |
| createServer((request, response) => { | |
| response.writeHead(200, {'Content-Type': 'text/plain'}); | |
| response.write('Hello World!'); | |
| response.end(); | |
| }).listen(8080); |
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 fs = require('fs'); | |
| const path = require('path'); | |
| function walkDir(dir, callback) { | |
| fs.readdirSync(dir).forEach(file => { | |
| const dirPath = path.join(dir, file); | |
| const isDirectory = fs.statSync(dirPath).isDirectory(); | |
| isDirectory ? | |
| walkDir(dirPath, callback) : callback(path.join(dir, file)); | |
| }); |
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, initial-scale=1"> | |
| <link | |
| rel="stylesheet" | |
| href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css" | |
| > | |
| <style> |
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
| # Find the location where CS:GO is installed: | |
| # 1. Open your Steam Library | |
| # 2. Right-click on "Counter-Strike: Global Offensive" in your list of games | |
| # 3. Select "Properties..." | |
| # 4. Select "Local Files" | |
| # 5. Click on "Browse..." | |
| # 6. Open the following location: | |
| # ...\Counter-Strike Global Offensive\csgo\cfg\autoexec.cfg | |
| # 7. Save the entries below to your "autoexec.cfg": |
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 fs = require('fs'); | |
| const testFolder = './test/'; | |
| fs.readdirSync(testFolder).forEach(file => { | |
| console.log(file); | |
| }); |