Skip to content

Instantly share code, notes, and snippets.

View theWhiteFox's full-sized avatar
👑
Crafting Web Apps - Continuous Learning

Stephen ♔ Ó Conchubhair theWhiteFox

👑
Crafting Web Apps - Continuous Learning
View GitHub Profile
@theWhiteFox
theWhiteFox / Dijkstra.js
Created January 16, 2018 22:12
Dijkstra created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/Dijkstra
const graph = {
start: { A: 5, B: 2 },
A: { C: 4, D: 2 },
B: { A: 8, D: 7 },
C: { D: 6, finish: 3 },
D: { finish: 1 },
finish: {},
};
console.log(graph);
@theWhiteFox
theWhiteFox / Dijkstra.js
Created January 16, 2018 21:36
Dijkstra created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/Dijkstra
const graph = {
start: {A:5, B:2},
A: {C:4, D:2},
B: {A:8, D:7},
C: {D:6, finish:3},
D: {finish:1},
finish: {}
}
console.log(graph);
// recursive starts at 0
function fib(number) {
if(number == 0) return 0;
if(number == 1) return 1;
return fib(number - 2) + fib(number - 1);
}
// shorter recursive starts at 1
function fibRecursive(n) {
if(n <= 1) return 1;
return fibRecursive(n - 2) + fibRecursive(n - 1);
}
// recursive. output starts at 0
function fib(number) {
if(number == 0) return 0;
if(number == 1) return 1;
return fib(number - 2) + fib(number - 1);
}
// shorter recursive. output starts at 1
function fibRecursive(n) {
if(n <= 1) return 1;
@theWhiteFox
theWhiteFox / FizzBuzz.js
Created January 13, 2018 14:32
FizzBuzz created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/FizzBuzz
console.log(7%3);
function fizzBuzz(num) {
for (var i = 1; i <= num; i++) {
if (i % 15 === 0) console.log("FizzBuzz");
else if (i % 5 === 0) console.log("fizz");
else if (i % 3 === 0) console.log("Buzz");
else console.log(i);
}
}
@theWhiteFox
theWhiteFox / modulus operator.js
Created January 13, 2018 11:30
modulus operator created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/modulus-operator
console.log(7%3);
<div class="marquee">
<p>Test</p>
</div>
@theWhiteFox
theWhiteFox / index.html
Created November 10, 2016 13:05
Sketch
<svg class="mid" xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0" y="0" width="677" height="427.7" viewBox="0 0 677 427.7" enable-background="new 0 0 677 427.669" xml:space="preserve">
<radialGradient id="shadow_1_" cx="3337.4" cy="53557.7" r="155.4" fx="3449.4" fy="53546.1" gradientTransform="matrix(0.773 0.6344 -0.0855 0.1042 2234.0835 -7382.4531)" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#231F20"/>
<stop offset="0.1" style="stop-color:#262626;stop-opacity:0.4"/>
<stop offset="0.3" style="stop-color:#555555;stop-opacity:0.3"/>
<stop offset="1" style="stop-color:#222222;stop-opacity:0"/>
</radialGradient>
<path id="shadow" fill-rule="evenodd" clip-rule="evenodd" fill="url(#shadow_1_)" d="M358.9 417.4c-7.5 9.1-68.5-28.5-136.2-84.1 -67.7-55.6-116.6-108.1-109.1-117.2 7.5-9.1 68.5 28.5 136.2 84.1C317.6 355.8 366.4 408.3 358.9 417.4z"/>
<g id="model">
<radialGradient id="lt-paths_1_" cx="7968.7" cy="-3320.7" r="1227.8" gradientTransform="matrix(-0.4