Skip to content

Instantly share code, notes, and snippets.

Avatar
🌯
eating a burrito

Nick O'Neill nickoneill

🌯
eating a burrito
View GitHub Profile
@nickoneill
nickoneill / Location.tsx
Created Nov 24, 2020
Lightweight Redux alternative, context through HOCs
View Location.tsx
// first, start with the usage in a react component, very simple and you just get access to state in stateProvider below,
// HOC injects our location-relation props from our state provider
import { WithLocationProps } from "../state/locationState";
import { withLocation } from "../state/stateProvider";
interface Props {}
class Location extends React.Component<Props & WithLocationProps> {
render() {
View metamask
0x57e9088cCAe9Ba689c8EDAE30b8925d1E121A0C7
View ZebraPrinter.swift
/**
`ZebraPrinterStatus` is a list of status responses we handle from the printer or during a connection attempt with the printer.
*/
enum ZebraPrinterStatus {
case Ready
case NotReady([ZebraPrinterError])
case Unknown
func message() -> String {
switch self {
@nickoneill
nickoneill / TableState.swift
Last active Jan 23, 2019
Easily add async state tracking to your UITableView data sources
View TableState.swift
protocol TableValuable {
associatedtype TableItem
static func loadingValue() -> TableItem
static func failedValue() -> TableItem
func value() -> TableItem
}
enum TableState<T: TableValuable> {
case Loading
case Failed
View autopersist.swift
var autopersist: String? {
set {
if let newValue = newValue {
Pantry.pack(newValue, key: "autopersist")
}
}
get {
return Pantry.unpack("autopersist")
}
}
@nickoneill
nickoneill / Usage
Last active May 19, 2016
Post to Slack from Parse Cloud Code
View Usage
var Slack = require('cloud/slack.js');
var slack = new Slack('https://hooks.slack.com/services/INCOMING_SLACK_WEBHOOK_URL');
return slack.send({text: msg}).then(function(){
// success
}, function(error){
// error
});
View keybase.md

Keybase proof

I hereby claim:

  • I am nickoneill on github.
  • I am nickoneill (https://keybase.io/nickoneill) on keybase.
  • I have a public key whose fingerprint is 1461 8A87 015A 2A12 91FF 1BBF 6F16 159E 7BA1 11F2

To claim this, I am signing this object:

@nickoneill
nickoneill / index.html
Created Jun 15, 2013
slightly saner boilerplate from html5 boilerplate
View index.html
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
@nickoneill
nickoneill / gist:5206442
Created Mar 20, 2013
Export a video path as mp4 and use the document interaction controller to send it
View gist:5206442
AVAsset *asset = [AVAsset assetWithURL:self.videoPaths[0]];
AVAssetExportSession *export = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetPassthrough];
[export setOutputURL:temp];
[export setOutputFileType:AVFileTypeMPEG4];
NSLog(@"export started");
[export exportAsynchronouslyWithCompletionHandler:^{
NSLog(@"export done: %d",[export status]);
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL:temp];
View SDLMain.h
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#ifndef _SDLMain_h_
#define _SDLMain_h_