Skip to content

Instantly share code, notes, and snippets.

View RaptorCentauri's full-sized avatar

Dave Shilander RaptorCentauri

View GitHub Profile
@RaptorCentauri
RaptorCentauri / ghpages-deploy.yml
Last active October 1, 2021 09:04
A GitHub action to deploy to GitHub-Pages
# This is a simple GitHub action to deploy a Single Page App to GitHub pages
# Change the branch name according to your needs.
# The npm package gh-pages is required as dev-dependency in your package.json for this to work
# You must set a homepage field in package.json
# Your deploy script must work properly
name: Deploy To Github Pages
on:
push:
/**
* Returns an alhabatized string.
* @param {String} str - String to be alphabatized?
*/
function alphabatize(str){
const keepCase = (a,b)=> a.toLowerCase().localeCompare(b.toLowerCase())
return str.split('').sort(keepCase).join('')
}
/**
* Returns the factorial of the num passed.
* @param {Number} num - What number do we need the factorial for?
*/
const factorial = (num) => num === 0 ? 1 : (num * factorial(num-1))
@RaptorCentauri
RaptorCentauri / removeDuplicates.js
Created June 26, 2021 14:58
Removes duplicate values from an array
/**
* Removes duplicate values from an array
* @param {Array} arr - An array of numbers
*/
const removeDuplicates = (arr) => [...new Set(arr)]
@RaptorCentauri
RaptorCentauri / dayOfWeek.js
Last active June 26, 2021 15:02
Get day of week from num
/**
* Returns the day of week based on number
* @param {number} num - a number representing a day of the week.
*/
const dayOfWeek = (num) => ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][num-1]