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 and retrieve the encryption key automatically | |
Note: This is a draft version, please help to modify, Thanks! | |
******************************************************/ | |
function keyFinder (str) { // str is used to get the input of encrypted string | |
const wordBank = [ | |
'I ', | |
'You ', | |
'We ', | |
'They ', |
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 DoubleLinkedListNode { | |
// Double Linked List Node built specifically for LFU Cache | |
constructor (key, val) { | |
this.key = key | |
this.val = val | |
this.freq = 0 | |
this.next = null | |
this.prev = null | |
} | |
} |
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 Sudoku { | |
// Sudoku Class to hold the board and related functions | |
constructor (board) { | |
this.board = board | |
} | |
findEmptyCell () { | |
// Find a empty cell in the board (returns [-1, -1] if all cells are filled) | |
for (let i = 0; i < 9; i++) { | |
for (let j = 0; j < 9; j++) { |
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 Temperature(degrees) { | |
this.degrees = degrees; | |
} | |
Temperature.prototype[Symbol.toPrimitive] = function(hint) { | |
switch (hint) { | |
case "string": | |
return this.degrees + "\u00b0"; // degrees symbol | |
case "number": | |
return this.degrees; |
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
mkdir html5-boilerplate | |
unzip html5-boilerplate*.zip -d html5-boilerplate | |
npx create-html5-boilerplate new-site | |
cd new-site | |
npm install | |
npm start |
NewerOlder