Skip to content

Instantly share code, notes, and snippets.

View thephilip's full-sized avatar
🎩
Think like a man of action, act like a man of thought.

Philip Smith thephilip

🎩
Think like a man of action, act like a man of thought.
  • Red Hat
  • Saint Petersburg, Florida
View GitHub Profile
// factorial (imperitive)
const factorial = n => {
let result = 1;
while (n > 1) {
result *=n;
n--;
}
return result;
};
/* Function object extension to add memoization
* to any single-argument function.
*/
Function.prototype.memoized = function () {
let key = JSON.stringify(arguments);
this._cache = this._cache || {};
this._cache[key] = this._cache[key] ||
this.apply(this, arguments);
@thephilip
thephilip / Tuple.js
Created March 17, 2017 21:26
JavaScript Tuple Implementation
/*
* Tuple.js - JavaScript Tuple Implmentation
* ------------------------------------------------
* The Tuple object is an immutable, fixed-length
* structure used to hold a heterogeneous set of n
* typed values that can be used for inter-function
* communication. For instance, you can use it to
* build quick value objects.
*
@thephilip
thephilip / profile.ps1
Last active November 30, 2016 14:09
Custom PowerShell Profile
# -----------------------------
# Custom PowerShell Profile
# By: Philip Smith
# -----------------------------
# Requires -Version 3
# -----------------------------
# Customizable Variables
# -----------------------------
@thephilip
thephilip / method.js
Created November 15, 2016 16:32
Method Implementation
// implements method
if (typeof Function.prototype.method !== "function") {
Function.prototype.method = function (name, implementation) {
this.prototype[name] = implementation;
return this;
};
}
@thephilip
thephilip / startnet.cmd
Created October 6, 2016 18:38
Startnet Replacement Script for Custom Deployment Scripts (PIP)
@echo off
echo ##### ## ##### # ##### ##
echo ###### /### ###### / ###### /###
echo /# / / ### /# / / /# / / ###
echo / / / ### / / / / / / ###
echo / / ## / / / / ##
echo ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo /### ## / /### ## /### ## /
@thephilip
thephilip / fixJNLPAssociation.cmd
Last active October 6, 2016 18:39
Java JNLP File Association Fix
@echo off
color e9
goto :CHECKPERMS
:RUN
:: Kill all IE processes
taskkill /f /im iexplore.exe /t >nul 2>&1
ping -n 1 127.0.0.1 >nul 2>&1