Skip to content

Instantly share code, notes, and snippets.

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

Stíofán ♔ Ó Conchubhair theWhiteFox

👑
Crafting Web UI Apps
View GitHub Profile
@theWhiteFox
theWhiteFox / encode-decode-pseudocode-brute-force.js
Created February 27, 2025 20:47
brute force solution for encode decode neet code problem
function encode(strs):
encodedStr = ""
// Iterate thru strings
for each str of strs:
// Escape colons in the string
escapedStr = str.replace(/:/g, "::")
// Append the length of the escaped string to the encodedStr
encodedStr += length(escapedStr) + ":" + escapedStr
@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 / index.html
Created July 24, 2017 10:04
SVG Glitch
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="600px" height="100px" viewBox="0 0 600 100">
<style type="text/css">
<![CDATA[
text {
filter: url(#filter);
fill: white;
font-family: 'Share Tech Mono', sans-serif;
// shorter recursive starts at 1
function fibRecursive(n) {
if(n <= 1) return 1;
return fibRecursive(n - 2) + fibRecursive(n - 1);
}
// recursive starts at 0
function fib(number) {
if(number == 0) return 0;
if(number == 1) return 1;
return fib(number - 2) + fib(number - 1);
}
// enter a number
function fibonacci(num) {
var a = 1, b = 0, temp2;
while(num > 0) {
temp2 = a;
a = a + b;
b = temp2;
num--;
console.log(temp2);
// 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;
// for loop
function fibFor() {
var a = 0, b = 1, i = 1, result;
result = b;
console.log(a + '\n' + result + '\n');
for(i; i < 10; i++) {
console.log(result + '\n');
result = a + b;
a = b;
b = result;
"use strict";
// below functions can be accessed from the console
// very basic fibonacci
function basicFib() {
var first = 1,
second = 0,
answer = first + second;
while(answer < 100) {