Skip to content

Instantly share code, notes, and snippets.

// Sum All Primes.js
/*
Sum all the prime numbers up to and including the provided number.
A prime number is defined as a number greater than one and having only two divisors, one and itself.
For example, 2 is a prime number because it's only divisible by one and two.
The provided number may not be a prime.
@SilentGamelan
SilentGamelan / launch.json
Created June 24, 2018 15:30
test for VSCode debugger
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
@SilentGamelan
SilentGamelan / app.js
Created June 24, 2018 15:27
test for VSCode debugger
function showMsg(msg){
console.log(msg);
}
function passMsg(myMsg){
showMsg(myMsg);
return("done");
}
var myMsg = "Hello World.";
@SilentGamelan
SilentGamelan / crack.c
Last active May 26, 2017 15:48
cs50 crack program - please critique style and function
/* crack.c - program to crack DES encypted passwords of up to 4 characters, plus 2 character salt
*
* Uses brute force method via recursively generating all combinations of letters contained in alphabet[]
* hashing the generated password with the suffixed salt, and returning a match value of 1 if a collision is detected
* ie; there is a match between the given hash and generated hash
*
* Have updated code to eliminate all global variables, instead passing variables into functions where required
* Memory overheads still acceptable as recursion depth is low, and arrays are passed by reference not value
*/