Skip to content

Instantly share code, notes, and snippets.

View brien-crean's full-sized avatar

Brien Crean brien-crean

  • Vancouver, Canada
View GitHub Profile
@brien-crean
brien-crean / FlightController.m
Last active August 20, 2020 20:51
Objective C flight controller singleton
@import DJISDK;
@interface RCTBridgeDJIFlightController : RCTEventEmitter<DJIFlightControllerDelegate> {
DJIFlightControllerState *flightControllerState;
NSString *testString;
}
@property(nonatomic, readonly) DJIFlightControllerState *flightControllerState;
@property(nonatomic, readonly) NSString *testString;
@brien-crean
brien-crean / ExampleRoute.md
Last active March 20, 2019 23:52
Simple add customer and customer address record

Simple POST endpoint to create a customer record and also a customer address record with associated foreign key

// create: customer and associated address record
app.post("/", (req, res) => {
  // Customer rec
  let insertCustomer = "INSERT INTO Customers (Name) VALUES(?)";
  const customerValues = [req.body.name];
  insertCustomer = mysql.format(insertCustomer, customerValues);
@brien-crean
brien-crean / react_interaction_observer_api.js
Created November 27, 2017 07:47
React component with Intersection Observer API
// simple react component to demonstrate intersection observer API usage
// renders box in red when fully visible otherwise renders in blue
import React, { Component } from 'react';
class Box extends Component {
constructor(props) {
super(props)
this.state = {
@brien-crean
brien-crean / twitter_oauth_user_context.js
Created July 14, 2017 18:22
Twitter 3 legged OAuth on AWS Lambda with NodeJS
const OAuth = require('oauth');
const Twit = require('twit');
const nconf = require('nconf');
// temp global var
var oAuthTokenSecret;
// load config file which contains twitter app tokens
nconf.file({ file: './config/twitter-share.json' }).env()
@brien-crean
brien-crean / iAps.swift
Created August 31, 2016 01:03
In App Purchases iOS - Swift 2
import Foundation;
import StoreKit;
struct ProductList {
static let twoWeekTrial : String = "twoweektrial"
static let monthlySub : String = "monthlytrial"
static let products = [twoWeekTrial, monthlySub]
}