Skip to content

Instantly share code, notes, and snippets.

@Nathan-Nesbitt
Nathan-Nesbitt / Installation_neo4j.sh
Created May 13, 2020 05:08
Installing Neo4j on Ubuntu
# For the most up to date information and installation process,
# go to https://neo4j.com/docs/operations-manual/current/installation/linux/debian/#debian-installation
# Get the debian package from neo4j
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.com stable latest' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
sudo apt-get update
# Installs neo4j
sudo apt-get install neo4j
@Nathan-Nesbitt
Nathan-Nesbitt / Function.js
Created May 10, 2020 21:23
Function Example JavaScript
// A function with no parameters and no return value
var myFunction = function() {
console.log("foobar");
}
// Calling the function //
myFunction();
// A function with 1 parameter and no return value
var myFunction2 = function(variable) {
@Nathan-Nesbitt
Nathan-Nesbitt / Queue.js
Created May 10, 2020 21:11
Queue Example JavaScript
// Example Queue //
var queue = [];
// Enqueue the values //
queue.push(1);
queue.push(2);
queue.push(3);
// Dequeue and print the values //
console.log(queue.shift());
@Nathan-Nesbitt
Nathan-Nesbitt / Stack.js
Created May 10, 2020 21:09
Stack Example JavaScript
// Create a "stack" //
var stack = [];
// Push values onto the stack //
stack.push(3);
stack.push(2);
stack.push(1);
// Print off the order that the values are in //
console.log(stack.pop());
@Nathan-Nesbitt
Nathan-Nesbitt / Array.js
Created May 10, 2020 20:58
Array Example JavaScript
// Creates an array //
var array = [];
// Another way of creating an array of size 2 //
var objectArray = new Array(2);
// Creates an array with some data already in it //
var arrayWithData = [1, 2, 3, 4];
// Adds a value to the array //
@Nathan-Nesbitt
Nathan-Nesbitt / ForOfLoop.js
Created May 10, 2020 20:32
For Of Loop Example
// Create an array of fruits //
var fruits = ['Orange', 'Banana', 'Apple'];
// Loop through the values in that array
for (var fruit of fruits) {
console.log(fruit);
}
// Create an object car with some attributes //
var car = {
brand:"Honda",
year:2018,
kms:2500
};
// Loops through the attributes in the object
for (var attribute in car) {
console.log(attribute + ": " + car[attribute]);
@Nathan-Nesbitt
Nathan-Nesbitt / DoWhile.js
Last active May 10, 2020 00:29
Do While Example
// Initialize
var i = 0;
do {
console.log(i)
// Increment
i++;
}
// Evaluate
while (i < 10);
/*
Prints out the values from 0 to 9
*/
// Initialization, Evaluation, and Increment
// all in one line
for(var i = 0; i < 10; i++) {
console.log(i);
}
@Nathan-Nesbitt
Nathan-Nesbitt / WhileLoops.js
Created May 10, 2020 00:04
While Loop Example
/*
This prints out the numbers from 0 to 9
*/
// Initialize
var i = 0;
// Evaluate
while(i < 10) {
console.log(i);