Skip to content

Instantly share code, notes, and snippets.

🕶
Grok'ing

Lacy Morrow lacymorrow

🕶
Grok'ing
Block or report user

Report or block lacymorrow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lacymorrow
lacymorrow / Utils.js
Created Aug 16, 2019
A handy collection of JS utility functions
View Utils.js
var Utils = {
sleep: function (milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
},
isUndefined: function (value) {
return typeof value === 'undefined';
},
isObject: function (o) {
return (
typeof o === 'object' &&
@lacymorrow
lacymorrow / util.css
Last active Mar 19, 2019
CSS Code Utilities
View util.css
/* Text smoothing */
body {
font-family: Camphor, Open Sans, Segoe UI, sans-serif;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* Nice hover effect
button:hover {
@lacymorrow
lacymorrow / docReady.js
Created Jan 28, 2019
A plain, vanilla, cross-browser JS document.ready function
View docReady.js
/* Credit to https://github.com/jfriend00/docReady
*
* Call with docReady(fn, context)
*/
(function(funcName, baseObj) {
"use strict";
// The public function name defaults to window.docReady
// but you can modify the last line of this function to pass in a different object or method name
// if you want to put them in a different namespace and those will be used instead of
// window.docReady(...)
@lacymorrow
lacymorrow / flash_fix.sh
Last active Jan 6, 2019
FIX ALMOST ANY FLASH OR SD CARD!
View flash_fix.sh
#vGet drive name
diskutil list
# then try
diskutil unmountDisk force /dev/DRIVENAME
# Then format
@lacymorrow
lacymorrow / js-sum.js
Created Sep 24, 2018
Simple function to sum an array
View js-sum.js
const numbers = [10, 20, 30, 40] // sums to 100
// function for adding two numbers. Easy!
const add = (a, b) =>
a + b
// use reduce to sum our array
const sum = numbers.reduce(add)
@lacymorrow
lacymorrow / .xinitrc
Created Sep 6, 2018 — forked from ncornette/.xinitrc
.xinitrc for kiosk mode
View .xinitrc
#!/bin/sh
# invoke global X session script
#. /etc/X11/Xsession
# HOW-TO :
# 1. Disable any Display Manager (lightdm/gdm/gdm3) from executing on startup
# 2. Allow user to start X :
# a. Edit /etc/X11/Xwrapper.config
# b. Set value : "allowed_users=anybody"
# 3. insert "su kiosk -c xinit &" into /etc/rc.local
@lacymorrow
lacymorrow / vnc.sh
Last active Sep 5, 2018
VNC connection for MagicMirror2 Raspberry Pi -> MacOS
View vnc.sh
# SSH from the Mac to the Pi with
# -Y: X-11 (trusted) forwarding
# -L VNC forwarding
ssh -Y -L 5901:localhost:5901 pi@10.0.0.20
# (in SSH session)
# Create VNC password
x11vnc -storepasswd
@lacymorrow
lacymorrow / magicmirror-install.md
Last active Sep 4, 2018
Complete MagicMirror2 Installation
View magicmirror-install.md
@lacymorrow
lacymorrow / parse-url-params.js
Last active Sep 4, 2018
JS - Parse URL `GET` parameters from and HTTP request
View parse-url-params.js
/* function parseURLParams
* Accepts a http parameter string or grabs the one from the current URL
* Returns a dictionary
* Ex: '?api_key=XYZ&version=2' => { api_key: 'XYZ', version: 2}
*
* query: string | undefined
*/
function parseURLParams (query) {
if(!query)
You can’t perform that action at this time.