Skip to content

Instantly share code, notes, and snippets.

@keithweaver
keithweaver / BankAccountSection.js
Created February 25, 2018 05:37
Used for a Stripe Connect & Node.js tutorial.
import React from 'react';
import PropTypes from 'prop-types';
export const BANK_ACCOUNT_FORM_COUNTRY = 'country';
export const BANK_ACCOUNT_FORM_CURRENCY = 'currency';
export const BANK_ACCOUNT_FORM_ROUTING_NUMBER = 'routing_number';
export const BANK_ACCOUNT_FORM_ACCOUNT_NUMBER = 'account_number';
export const BANK_ACCOUNT_FORM_ACCOUNT_HOLDER_NAME = 'account_holder_name';
export const BANK_ACCOUNT_FORM_ACCOUNT_HOLDER_TYPE = 'account_holder_type';
@keithweaver
keithweaver / Home.js
Created March 28, 2018 11:07
Socket.io Medium Post
import React, { Component } from 'react';
import 'whatwg-fetch';
import openSocket from 'socket.io-client';
const socket = openSocket('http://localhost:8000');
class Home extends Component {
constructor(props) {
super(props);
@keithweaver
keithweaver / FollowCamera.cs
Created June 12, 2018 23:57
Move the camera when the mouse reaches the edge of the screen.
// Attach to the camera asset
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowCamera : MonoBehaviour {
private int screenWidth;
private int screenHeight;
public int speed = 5;
{
"if": {
"classNames": [ "demo" ]
}
}
@keithweaver
keithweaver / index.json
Last active July 13, 2018 11:10
temp 2
{
"reservedWords": ["default", "index","custom"],
"themes": {
"default": {
"json": "https://gist.githubusercontent.com/keithweaver/6b87e9f0bf559c81d8201f3e4b33b262/raw/230c89c855338aee6ae865bd575d6421923fe25a/default.json",
"css": "../themes/default.css"
},
"custom": {}
}
}
@keithweaver
keithweaver / signin.js
Last active December 11, 2018 18:06
Sign in endpoints
const User = require('../../models/User');
const UserSession = require('../../models/UserSession');
module.exports = (app) => {
/*
* Sign up
*/
app.post('/api/account/signup', (req, res, next) => {
const { body } = req;
@keithweaver
keithweaver / with-pi-cam-step1.py
Last active December 16, 2018 15:41
Sample code used in http://localhost:3000/docs/tutorial/smart-dashcam
def delete_image(image_object):
# TODO
print ('delete_image')
def process_image(image_object):
# TODO
print ('process_image')
def take_image_from_pi_cam():
print ('insert_take_image')
@keithweaver
keithweaver / with-pre-record-step1.py
Created December 16, 2018 15:43
Sample code used in http://localhost:3000/docs/tutorial/smart-dashcam
def delete_image(image_object):
# TODO
print ('delete_image')
def process_image(image_object):
# TODO
print ('process_image')
def get_image_from_path(image_path):
print ('get_image_from_path')
@keithweaver
keithweaver / run-custom-cascade.py
Last active January 14, 2019 07:26
Object detection using custom Haar Cascade on an image with OpenCV
# Running:
# $ python run-custom-cascade.py
# Import OpenCV
import cv2
# Image file
IMAGE_FILE = './example.png' # Change this to be your image
# Cascade file
@keithweaver
keithweaver / status.json
Created July 17, 2019 20:46
The status of the Local Network application.
{
"version": 1,
"isLive": true,
"message": "The application is still live, check keithweaver.ca"
}