Skip to content

Instantly share code, notes, and snippets.

View verticalgrain's full-sized avatar

Jamie Graham verticalgrain

View GitHub Profile
@verticalgrain
verticalgrain / my-collectio-links.json
Last active December 26, 2024 01:00
User data for Collectio page
@verticalgrain
verticalgrain / gist:d81556dad6e9c58ea4b10612d4b10ddf
Last active June 24, 2023 04:36
Roblox localscript examples
-- Place this LocalScript inside a part in the Workspace or a child of the player's character
-- Constants
local PLAYER = game.Players.LocalPlayer
local Z_KEY_CODE = Enum.KeyCode.Z
local BLOCK_COLOR = BrickColor.new("Bright red")
-- Create the block
local block = Instance.new("Part")
block.Size = Vector3.new(2, 2, 2)
@verticalgrain
verticalgrain / header-simplified.css
Last active February 17, 2021 16:34
AJ Interactive article starter
.header-simplified {
width: 100%;
height: 70px;
display: flex;
justify-content: center;
position: fixed;
top: 0;
overflow: hidden;
z-index: 9999999;
background: white;
@verticalgrain
verticalgrain / mailchimp-async-submit.js
Created July 13, 2019 01:20
Mailchimp Asynchronous Submit
/*
* Submit mailchimp form asynchronously
* Modify mailchimp form action URL - replace subscribe/post? with subscribe/post-json?
* Example: Replace https://bevcanna.us7.list-manage.com/subscribe/post? with https://bevcanna.us7.list-manage.com/subscribe/post-json?
*/
function validateEmail(Email) {
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return $.trim(Email).match(pattern) ? true : false;
}
@verticalgrain
verticalgrain / aws-docker.txt
Last active May 1, 2019 18:17
AWS & Docker
// Configure AWS Cli with authentication
aws configure
// Run aws ecr get-login command to generate AWS login command for docker
// Run command, then copy and paste output, and run that to log in
// If pulling images from multiple AWS regions, run command again,
// replacing us-east-1 with correct region, for as many regions as necessary
aws ecr get-login --no-include-email --region us-east-1
@verticalgrain
verticalgrain / get-modified-term-list.php
Last active April 2, 2019 20:40
Use Yoast primary category functionality to order primary category before other categories on frontend
<?php
function get_modified_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '', $exclude = array() ) {
$terms = get_the_terms( $id, $taxonomy );
if ( is_wp_error( $terms ) )
return $terms;
if ( empty( $terms ) )
return false;
@verticalgrain
verticalgrain / FirebaseArduino Cheat Sheet
Created January 14, 2019 18:14
Cheat Sheet for FirebaseArduino
// set value
Firebase.setFloat("number", 42.0);
// update value
Firebase.setFloat("number", 43.0);
// get value
Serial.print("number: ");
Serial.println(Firebase.getFloat("number"));
@verticalgrain
verticalgrain / chip-flashing-guide-nov-2018.md
Last active August 31, 2024 12:51
NextThingCo C.H.I.P. Flashing guide as of November, 2018

Below are the steps required to flash a NextThingCo CHIP or PocketCHIP from the command line, as of November 2018. The web flasher no longer works, and there are numerous errors when flashing from the command line, mostly due to broken dependencies. The following method works for flashing a CHIP as of November 2018:

Note: Flashing must be done on Linux. Tested on Ubuntu and Rasparian. Mac OS seems to not work.

  1. Download and unpack the CHIP-SDK.zip from one of the following:
  1. Download and unpack CHIP-tools.zip from one of the following:
@verticalgrain
verticalgrain / Docker Gist
Last active May 27, 2019 17:04
Docker Gist
// clean cache and do some ot her scary stuff
docker system prune -a
// List all containers (only IDs)
docker ps -aq.
// Stop all running containers.
docker stop $(docker ps -a -q)
// From: https://blog.gordonturner.com/2017/12/10/raspberry-pi-full-screen-browser-raspbian-december-2017/
// Short URL to this document:
goo.gl/yx5pcX
// Install Raspbarian
// Log in
// Install on screen keyboard
// Open Terminal and run: