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 | |
# This script creates a new post or draft in jekyll with pre-filled front matter. | |
# Run `./script <some title for your post>` to generate a post. | |
# Use `-d` option (BEFORE your post title) for a draft. | |
FILEDIR="_posts/" | |
ISDRAFT=false | |
while getopts "d" opt; do | |
case $opt in |
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
// To run: copy this file (or open it using the "Raw" button in the right-hand corner) and save it as linkedList.js | |
// Then in the terminal, run `node linkedList.js | less` to view output and compare expected to actual values. | |
class LinkedList { | |
constructor(firstItem) { | |
this.list = { | |
data: firstItem, | |
link: {} | |
}; |
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 vertices = ['james', 'jon', 'joe', 'moe', 'moda']; | |
const vertices2 = ['jon', 'joe', 'moe']; | |
const vertices3 = ['james', 'joe', 'moda']; | |
const edges = [['james', 'jon'], ['james', 'joe'], ['jon', 'joe'], ['joe', 'moe'], ['moe', 'moda'], ['moda', 'james']]; | |
const edges2 = [['jon','joe'], ['joe', 'moe'], ['moe', 'jon']]; | |
const edges3 = [['james', 'joe'], ['moda', 'james']]; | |
function createAdjacencyList(vertices, edges) { |
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 words = ['dark', 'dapper']; | |
let trie = []; | |
words.forEach(word => { | |
addToTrie(word, 0, trie); | |
}); |
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 nodes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']; | |
const tree = { node: nodes[0], children: [{}, {}] }; | |
addNodes(tree.children[0], nodes[1], 1); | |
addNodes(tree.children[1], nodes[2], 2); | |
function addNodes(theRoot, node, index) { | |
if (!nodes[index]) { |
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 fs = require('fs'); | |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
const tsvFileName = process.argv[2]; |
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> | |
<head> | |
<title></title> | |
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/tachyons/4.5.5/tachyons.min.css"> | |
</head> | |
<body class="sans-serif center" style="width:80%; display: flex; justify-content: center; flex-wrap: wrap"> | |
<div style="width: 100%"> | |
<button class="bg-orange" style="margin: 30px; height:160px; width: 260px" onclick="playGame()"> |
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 Queue(originalQueue) { | |
let queue = originalQueue || []; | |
function removeElement(q, i) { | |
const index = i === 'last' ? q.length - 1 : i; | |
if (!q[index + 1]) { | |
q[index] = undefined; | |
q.length = q.length - 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
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { | |
input_stdin += data; | |
}); |
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 chooseMove(board) { | |
function getAvailableLocations() { | |
var availableLocations = []; | |
for (var location in board) { | |
// Since key === value is the default, if this is true, | |
// it means the spot has not yet been played. | |
if (location === board[location]) { |
NewerOlder