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
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ | |
host : 'redacted', | |
user : 'redacted', | |
password : 'redacted', | |
database : 'redacted' | |
}); | |
function randomClass() { |
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
<?xml version='1.0' encoding='utf-8'?> | |
<!DOCTYPE hsreplay SYSTEM "https://hearthsim.info/hsreplay/dtd/hsreplay-1.6.dtd"> | |
<HSReplay version="1.6"> | |
<Game ts="11:27:02.657831"> | |
<GameEntity id="1"> | |
<Tag tag="202" value="1"/> | |
<Tag tag="49" value="1"/> | |
<Tag tag="53" value="1"/> | |
</GameEntity> | |
<Player id="2" playerID="1" accountHi="144115193835963207" accountLo="24163744" name="jrott#1315"> |
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 http = require('http'); | |
const fileSystem = require('fs'); | |
const path = require('path'); | |
const hostname = 'localhost'; | |
const host_port = 8000; | |
const client_port = 8001; | |
function serveAsset(rootPath, url, res) { | |
// default root route to index.html in the folder |
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 checkLoopInvariant = (newArr, originalArr, index) => { | |
//need to slice at least 1 element out | |
if (index < 1) index = 1 | |
newArr = newArr.slice(0,index) | |
originalArr = originalArr.slice(0, index) | |
for (let i=0; i < newArr.length; i++) { | |
//check that the original array contains the value |
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 insertionSort = (nums) => { | |
for (let i = 1; i < nums.length; i++) { | |
let j = i - 1 | |
let tmp = nums[i] | |
while (j >= 0 && nums[j] > tmp) { | |
nums[j + 1] = nums[j] | |
j-- | |
} | |
nums[j+1] = tmp | |
} |
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 selectionSort = (nums) => { | |
for (let i = 0; i < nums.length - 1; i++) { | |
let smallest = nums[i] | |
let swapIndex = i | |
for (let j = i + 1; j < nums.length; j++) { | |
if (nums[j] < smallest) { | |
smallest = nums[j]; | |
swapIndex = j | |
} | |
} |
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 checkLoopInvariant = (newArray, originalArray, index) => { | |
newArray = newArray.slice(0, index) | |
originalArray = originalArray.sort((a,b) => a > b ? 1 : - 1).slice(0,index) | |
if (index === 0) return true //no elements sorted yet | |
for (let i = 0; i < newArray.length; i++) { | |
if (!originalArray.includes(newArray[i])) { | |
console.warn(`Error! ${newArray[i]} not one of the ${index} smallest elements`) | |
} |
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
function identity (value) { | |
return value; | |
} | |
console.log(identity(1)) // 1 |
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
function identity (value) { | |
return value; | |
} | |
console.log(identity(1)) // 1 |
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
function identity (value: Number) : Number { | |
return value; | |
} | |
console.log(identity(1)) // 1 |
OlderNewer