Skip to content

Instantly share code, notes, and snippets.

View lacyrhoades's full-sized avatar
💭
Typing frantically!

Lacy lacyrhoades

💭
Typing frantically!
View GitHub Profile
func doTheThing() {
// First let's at least try to fix up each thing
// Has to be one-at-a-time
let waitGroup = DispatchGroup()
for missingID in self.missingIDs {
waitGroup.enter()
self.utility.tryToFixStuff(forItemID: missingID) {
waitGroup.leave()
}
@lacyrhoades
lacyrhoades / JSONPersistence.swift
Last active July 11, 2017 21:51
Swift 3 object to JSON file layer
//
// JSONPersistence.swift
// Fobo
//
// Created by Lacy Rhoades on 7/11/17.
// Copyright © 2017 Colordeaf. All rights reserved.
//
import Foundation
import SwiftyJSON
@lacyrhoades
lacyrhoades / 01.xml
Created April 28, 2017 16:07
Breeze DSLR Remote Pro profile example
<?xml version="1.0" encoding="UTF-8"?>
<dslr_remote_pro version="3.5.2" build_date="Jun 22 2016">
<photobooth_settings>
<numberOfPhotoboothImages>1</numberOfPhotoboothImages>
<photoboothBackgroundColor>16777215</photoboothBackgroundColor>
<photoboothDelayBeforePrintingInSecs>0</photoboothDelayBeforePrintingInSecs>
<photoboothClickerMode>0</photoboothClickerMode>
<photoboothInactivityTimeout>300</photoboothInactivityTimeout>
<photoboothNumberOfColumns>1</photoboothNumberOfColumns>
<photoboothNumberOfRows>1</photoboothNumberOfRows>
func debug() {
let manager = ThingManager()
let thing1 = Thing(name: "thing1")
manager.addThing(thing1)
manager.sawSomeThing(named: thing1.name)
print("Manager has this many things: ", manager.things.count)
Timer.scheduledTimer(withTimeInterval: 10.0, repeats: false, block: { (timer) in
// By now, the manager should have forgotten about the thing
print("Manager has this many things: ", manager.things.count)
})
@lacyrhoades
lacyrhoades / Extensions.swift
Last active November 9, 2016 14:51
Swift 3 networking primitives
// Not sure this all works
// I only use copyAsSockAddr which seems fine
extension sockaddr_in {
var addressString: String {
let sadr: UInt32 = self.sin_addr.s_addr
let b = (UInt8( sadr >> 24 ),
UInt8((sadr >> 16) & 0xff),
UInt8((sadr >> 8) & 0xff),
UInt8( sadr & 0xff))
diff --git a/lib/lighthouse.js b/lib/lighthouse.js
index f9a00c8..2a292e9 100644
--- a/lib/lighthouse.js
+++ b/lib/lighthouse.js
@@ -2,11 +2,13 @@ var Netmask = require('netmask').Netmask
var dgram = require('dgram');
var os = require('os');
+var PORT = 3001;
+var MULTICAST_ADDR = "224.1.1.1";
@lacyrhoades
lacyrhoades / gist:c9365a079848f1bc3745b43a93643948
Created May 14, 2016 21:29
pod lib lint --allow-warnings --verbose (v1.0.0)
This file has been truncated, but you can view the full file.
17:21 $ sudo gem update
Password:
Updating installed gems
Updating cocoapods
Fetching: cocoapods-core-1.0.0.gem (100%)
Successfully installed cocoapods-core-1.0.0
Fetching: cocoapods-deintegrate-1.0.0.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.0
Fetching: cocoapods-downloader-1.0.0.gem (100%)
Successfully installed cocoapods-downloader-1.0.0
@lacyrhoades
lacyrhoades / gist:2b86ea7993a76c661e3dc8604aba11a6
Created May 14, 2016 21:21
pod lib lint --allow-warnings --verbose (v0.39.0)
This file has been truncated, but you can view the full file.
17:20 $ pwd
/Users/lacy/Projects/GPUImage
✔ ~/Projects/GPUImage [master|⚑ 1]
17:20 $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
✔ ~/Projects/GPUImage [master|⚑ 1]
17:20 $ pod lib lint --allow-warnings --verbose
// Pin names based on https://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf
int serial_clock_pin = 2; // SHCP, Shift register clock
int serial_data_pin = 4; // DS, Serial data input
int register_clock_pin = 6; // STCP, Storage Clock, finalizes a series of serial inputs
int clear_pin = 8; // MR, Clear / Reset all storage (active LOW)
int output_enable_pin = 10; // OE, Enable output (active LOW) otherwise all output pins are LOW
void setup() {
pinMode(serial_clock_pin, OUTPUT);
@lacyrhoades
lacyrhoades / gist:7682239
Last active December 29, 2015 14:09
errors when ./dogFoofing
lrhoades:oclint-scripts(lacyrhoades-master)$ ./dogFooding
-- The C compiler identification is Clang 3.5.0
-- The CXX compiler identification is Clang 3.5.0
-- Check for working C compiler: /Users/lrhoades/development/oclint/build/llvm-install/bin/clang
-- Check for working C compiler: /Users/lrhoades/development/oclint/build/llvm-install/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /Users/lrhoades/development/oclint/build/llvm-install/bin/clang++
-- Check for working CXX compiler: /Users/lrhoades/development/oclint/build/llvm-install/bin/clang++ -- works
-- Detecting CXX compiler ABI info