Continued setup of a nextjs typescript installation.
setup.sh
is the shell script to run to set up the rest of the installation and pull in the files bundled in this gist.
Continued setup of a nextjs typescript installation.
setup.sh
is the shell script to run to set up the rest of the installation and pull in the files bundled in this gist.
# .profile | |
# Pretty minimal at the moment. | |
# Aliases | |
# listing | |
alias l='ls -al' | |
# git | |
alias g='git ' |
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
// freecodecamp | |
// advanced algorithm scripting | |
// validate us telephone numbers | |
function telephoneCheck(str) { | |
var regex = /^1?\s?((\(\d{3}\))|\d{3})(\s|\-)?\d{3}(\s|\-)?(\d{4})$/; | |
return regex.test(str); | |
} |
function truthCheck(collection, pre) { | |
var count = 0; | |
// loop through each object in the collection array | |
collection.forEach(function(element, index){ | |
// loop through each key in the object | |
for (var key in element) { | |
// iterate through the object's properties | |
if (element.hasOwnProperty(key)) | |
if (!element[pre]) |
// freecodecamp | |
// intermediate algorithm scripting | |
// binary agents | |
function binaryAgent(str) { | |
// break the long string of numbers in binary in to an array of strings | |
var arr = str.split(" "); | |
// declare 2 empty array | |
var arr2 = []; |
// freecodecamp | |
// intermediate algorith scripting | |
// steamroller | |
function steamrollArray(arr) { | |
// create array to push non array items in to | |
var arr2 = []; | |
// create function that will flatten arrays | |
function flat(curr) { |
// project euler 2 | |
// Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
// 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
// By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. | |
// declare initial variables | |
var a = 0; | |
var b = 1; |
// freecodecamp | |
// intermediate algorithm scripting | |
// drop it | |
// Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true. | |
// The second argument, func, is a function you'll use to test the first elements of the array to decide if you should drop it or not. | |
// Return the rest of the array, otherwise return an empty array. | |
function dropElements(arr, func) { |
// freecodecamp | |
// intermediate algorithm scripting | |
// finders keepers | |
function findElement(arr, func) { | |
// create empty second array | |
var arr2 = []; | |
// filter through array | |
arr.filter(function(item) { |