Skip to content

Instantly share code, notes, and snippets.

View CyberGen49's full-sized avatar
🛌
eepy

Kayla CyberGen49

🛌
eepy
View GitHub Profile
@CyberGen49
CyberGen49 / bozo.js
Created July 26, 2022 11:08
An anti-sorting algorithm.
// Bozo Sort - An anti-sorting algorithm
function bozoSort(arr = []) {
for (let i = 0; i < arr.length; i++) {
let tmp = arr[i];
let swapIndex = Math.round(Math.random()*(arr.length-1));
arr[i] = arr[swapIndex];
arr[swapIndex] = tmp;
}
@CyberGen49
CyberGen49 / numerals.js
Last active May 9, 2022 09:31
Integer to Roman Numerals
function numeral(num) {
const ones = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
const tens = ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'];
const huns = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'];
return [
'X̅'.repeat(Math.floor(num/10000)),
'M'.repeat(Math.floor((num%10000)/1000)),
huns[Math.floor((num%1000)/100)],
tens[Math.floor(((num%1000)%100)/10)],
ones[Math.floor(((num%1000)%100)%10)]
@CyberGen49
CyberGen49 / deck.json
Last active July 6, 2022 02:04
JSON data for a deck of cards, along with the Javascript used to create it.
[
{
"suite": "hearts",
"value": 2,
"name": 2,
"nameFull": "2 of hearts"
},
{
"suite": "hearts",
"value": 3,