Skip to content

Instantly share code, notes, and snippets.

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

Lacy lacyrhoades

💭
Typing frantically!
View GitHub Profile
extension UIImage {
func imageCenterCroppedTo(cropSize: CGSize) -> UIImage {
let cropWidth: CGFloat = cropSize.width // 200
let cropHeight: CGFloat = cropSize.height // 200
let cropRatio = cropWidth / cropHeight
let naturalRatio = self.size.width / self.size.height
var scaledWidth = cropWidth
$ git push origin master
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ ls ~/.ssh
import Foundation
import Photos
typealias AssetID = String
class ImageUtil {
static var defaultAlbumName = "App Name"
static var videosAlbumName = "App Name Videos"
diff --git a/Common/ImageProcessor.swift b/Common/ImageProcessor.swift
index 5afa17c..71d098f 100644
--- a/Common/ImageProcessor.swift
+++ b/Common/ImageProcessor.swift
@@ -23,9 +23,9 @@ class ImageProcessor {
assetFetcher?.images(ofType: .originalImage, forItemID: item.id, completion: { (images) in
var allFiltered: [UIImage] = []
+ self.processingQueue.async {
var filterIterator = item.filters.makeIterator()
@lacyrhoades
lacyrhoades / IndexingIterator+Infinite.swift
Last active October 5, 2017 16:46
Circular iterator in Swift
extension IndexingIterator {
mutating func next(wrapping: Bool) -> IndexingIterator.Element? {
if let result = self.next() {
return result
} else {
self = self.makeIterator()
return self.next()
}
}
}
​$ curl -I https://dl.dropboxusercontent.com/content_link/lPgRAQvSdMOHDRb2GLvRj5mX8H6XJC8G7QmWnubTOO9aHZ5eH8FZSHF6l8HRZzJR/file?dl=1
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 07 Sep 2017 14:29:34 GMT
Content-Type: application/binary
Content-Length: 26453
Connection: keep-alive
referrer-policy: no-referrer
x-content-type-options: nosniff
content-disposition: attachment; filename="fobo-66_2017090710145701.jpg"; filename*=UTF-8''fobo-66_2017090710145701.jpg
#include "usb_dev.h"
const int pinLED = 13;
void setup() {
pinMode(pinLED, OUTPUT);
usb_init();
while (usb_configuration == 0) {
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>