Skip to content

Instantly share code, notes, and snippets.

View paalwilliams's full-sized avatar
🎯
Focusing

Paal Williams paalwilliams

🎯
Focusing
View GitHub Profile
@paalwilliams
paalwilliams / usefulArrays
Created December 16, 2019 07:23
Useful Arrays
let alphabetUpper = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
let alphabetLower = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
let numStrArr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
let numArr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@paalwilliams
paalwilliams / findbigelements.js
Last active May 17, 2020 01:42
find and console log elements overflowing the page (horizontal scroll)
//Console log elements wider than page
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
<script
type="text/javascript"
src="http://lhgallery.pwmd.biz/ndxzsite/js/watney/jquery.min.js"
></script>
<script
type="text/javascript"
src="http://lhgallery.pwmd.biz/ndxzsite/js/watney/jquery.ui.min.js"
></script>
<link
rel="stylesheet"
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
@paalwilliams
paalwilliams / clone_wp_multisite_aws_bitnami.md
Last active May 15, 2020 02:52
Clone Wordpress Multisite on AWS

Clone an AWS instance

Instructions from here https://docs.bitnami.com/aws/faq/administration/clone-server/

  • Log in to the AWS Management Console.

  • If required, use the region selector in the top right corner to switch to the region where your instance was launched.

  • Select your instance and then select the “Create Image” option in the “Actions” menu.

@paalwilliams
paalwilliams / CCF_googlecloudprint_config.md
Last active June 24, 2020 23:29
Google Cloud Printer Configuration for Raspberry PI - Crazy Cheap Fireworks
@routes.post("/sendCommand")
async def setCommand(request):
commandObj = await request.json()
newBearing = commandObj['bearing']
newLook = commandObj['look']
newSlow = commandObj['slow']
if newBearing in MotorController.validBearings:
motorController.setBearing(newBearing, newSlow)
else:
@paalwilliams
paalwilliams / excerpt_janus.js
Created May 12, 2020 19:46
fix for watney janus.js w/ cors
fetching
.then(function (response) {
if (response.status > 199 && response.status < 400) {
if (typeof options.success === typeof Janus.noop) {
return response
.json()
.then(function (parsed) {
options.success(parsed);
})
.catch(function (error) {
@paalwilliams
paalwilliams / indexplus.html
Last active May 18, 2020 03:56
Fix Watney Info button
<div id="info" tabindex="-1" style="display: none">
<pre>Controls:
Arrow keys: move the rover
Shift: slow movement
A: look up
Z: look down
S: Text to speech
V: Push-to-talk
</pre>
</div>
@paalwilliams
paalwilliams / docker-compose.yaml
Last active September 15, 2021 22:19
Docker Compose File for Wordpress
version: '3'
services:
# Database
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment: