Skip to content

Instantly share code, notes, and snippets.

View sbrichardson's full-sized avatar
:octocat:
In coding land

Stephen Richardson sbrichardson

:octocat:
In coding land
View GitHub Profile
@sbrichardson
sbrichardson / what-forces-layout.md
Created December 9, 2019 01:42 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@sbrichardson
sbrichardson / clone-all-twitter-github-repos.sh
Created July 8, 2019 03:34 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@sbrichardson
sbrichardson / opencv_blackfly.cpp
Created June 18, 2019 05:08 — forked from kevinhughes27/opencv_blackfly.cpp
A simple program showing how to capture from a Point Grey Research Camera and display the image using OpenCV
#include "FlyCapture2.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace FlyCapture2;
int main()
@sbrichardson
sbrichardson / opencv_blackfly.cpp
Created June 18, 2019 05:08 — forked from kevinhughes27/opencv_blackfly.cpp
A simple program showing how to capture from a Point Grey Research Camera and display the image using OpenCV
#include "FlyCapture2.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace FlyCapture2;
int main()
@sbrichardson
sbrichardson / tracking_info_from_email.js
Last active June 12, 2019 03:42
Misc notes when researching a solution for tracking Amazon Deliveries since there isn't a public API available.
/**
* NOTE Breakdown of tracking url in shipping email from Amazon
* Delivery by Amazon, Tracking ID: TBA269148761000
*
*
* NOTE Process overview to obtain the tracking info and obtain
* updates for the delivery.
*
* Do Once
* ====================================
@sbrichardson
sbrichardson / Player.jsx
Created April 15, 2019 16:45 — forked from vincentriemer/Player.jsx
Player code for my Apple Music clone
// @flow
import * as React from "react";
import {
View,
StyleSheet,
Image,
Animated,
TouchableOpacity,
Text,
@sbrichardson
sbrichardson / polar.js
Last active December 31, 2023 08:14
Connects to a nearby bluetooth heart rate monitor and logs the active heart rate at 1hz (once per second). Tested with a Polar H10 HR monitor using Google Chrome.
/*
Make sure you are wearing the hr monitor, as it typically
goes to sleep when inactive, not allowing you to connect to it.
Instructions
=============
1. Using Google Chrome, open the dev console and paste the below code.
2. A panel near the address bar will open, searching for nearby bluetooth (ble)
heart rate devices. Don't click away from the panel or Chrome will cancel the search.
@sbrichardson
sbrichardson / sqlite-to-json.js
Created January 11, 2019 01:08
Browser based sqlite -> JSON/CSV. Exports sqlite database tables (using sql.js) to JSON, CSV, other (dev in progress).
/* NOTE Originally based on github.com/Philzen/WebSql-Loader */
const TABLE_SQL = "SELECT tbl_name from sqlite_master WHERE type = 'table'"
const MASTER_SQL = 'SELECT sql FROM sqlite_master'
const WEBKIT_INFO = '__WebKitDatabaseInfoTable__'
/* TODO Add other formats */
const FORMAT = {
JSON: 'json',
// CSV: 'csv',
@sbrichardson
sbrichardson / deploy.sh
Last active January 15, 2019 13:39
Poor man's continuous integration script, simple code deployment to Kubernetes on GCP (Google Cloud Platform)
#!/bin/bash
#
# Checks Google Cloud container registry to see if build has finished deploying new image from
# source repository recent update. "GCP" stands for "Google Cloud Platform" when used below.
#
# By default, retries 9 times, waiting 45 seconds between attempts.
#
# Configure the variables at the top of the file for your environment