Skip to content

Instantly share code, notes, and snippets.

View heaversm's full-sized avatar

Mike Heavers heaversm

View GitHub Profile
@heaversm
heaversm / useful-wp-commands.sh
Created October 31, 2019 14:10
Useful helpers for wordpress
#Add a new user
wp user create <username> <email> --role=administrator --user_pass=mypassword
@heaversm
heaversm / common-js-workflows.md
Last active October 16, 2019 19:49
Common JS Workflows

COMMON JS WORKFLOWS

Use an ES6 Module

With Unpkg

Add type="module" to script tags:

<script type="module">
  //then make sure to use the param module in unpkg:
@heaversm
heaversm / git-commands.sh
Created October 16, 2019 17:36
Useful git commands
#verify remotes
git remote -v
#edit git config
git config -e
@heaversm
heaversm / eslint-commands.js
Created October 16, 2019 16:52
ESLint helpful notes and commands
//disables the current line:
// eslint-disable-line
//at top of file, disables linting on the entire file:
/* eslint-disable */
@heaversm
heaversm / useful-terminal-commands.sh
Last active January 3, 2021 19:00
Terminal commands, workflows, and utilities
#force remove in powershell and unix
rm -rf [directory]
rm -r -fo [directory]
# download a blob url for a video
#Use the HLS Downloader Google Chrome extension to get the link to the M3U playlist
#Copy that url into the script below
youtube-dl --all-subs -f mp4 -o "file-name-to-save-as.mp4" "[M3U_List_URL]"
@heaversm
heaversm / js-utilities.js
Last active August 30, 2020 16:23
Common JS Utility Functions
//MAP A NUMBER FROM ONE RANGE TO ANOTHER:
function map_range(value, low1, high1, low2, high2) {
return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
}
//RANDOM DECIMAL NUMBER BETWEEN [MIN] and [MAX]:
randomNumber(min, max) {
return Math.random() * (max - min) + min;
}
@heaversm
heaversm / common-python-commands.sh
Last active February 26, 2020 18:56
Frequently used python commands
#pyenv
#have pyenv manage versions:
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
#activate changes:
source ~/.bash_profile
#install particular versions
pyenv install X.X.X
@heaversm
heaversm / server-commands.sh
Last active August 8, 2020 04:39
Server Commands
php -S localhost:8080
#boots a local php server
python -m SimpleHTTPServer
#boots a local http server on python 2
python -m http.server
#boots a local http server on python 3
sass --watch main.scss main.css
@heaversm
heaversm / runway-model-info.js
Created August 14, 2019 19:48
Get Runway Model Info as JSON
let modelOutput;
fetch('http://localhost:8000/info')
.then(response => response.json())
.then(output => {
modelOutput = output;
// use the output in your project
console.log(output);
//to copy it from the console, right click the object in chrome and choose 'save as global variable'
//then type copy(temp1) and paste the clipboard contents into a .json file
@heaversm
heaversm / index.html
Last active March 5, 2023 20:54
Create animated transitions between StyleGAN images with P5.js and Runway ML
<html>
<head>
<script src="js/lib/p5.js"></script>
<script src="js/lib/p5.dom.js"></script>
<script src="js/lib/toxiclibs.js"></script>
<script src="data/landscape.js"></script>
<script src="js/stylegan-transition.js"></script>
</head>
<body>
</body>