This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func takeScreenshot(view: UIView) -> UIImageView { | |
UIGraphicsBeginImageContext(view.frame.size) | |
view.layer.renderInContext(UIGraphicsGetCurrentContext()) | |
let image = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) | |
return UIImageView(image: image) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def segment_image(image_path, api_key): | |
with open(image_path, 'rb') as image_file: | |
response = requests.post( | |
'https://api.deepai.org/api/deepmask', | |
files={'image': image_file}, | |
headers={'api-key': api_key} | |
) | |
if response.status_code == 200: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Check.swift | |
// Points | |
// | |
// Created by Glen Hinkle on 10/2/16. | |
// Copyright © 2016 Zombie Dolphin. All rights reserved. | |
// | |
import Foundation | |
import CoreBluetooth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npx tsc-watch --onsuccess "node lib/index.js server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// CertificateRequest | |
// | |
// Created by Glen Hinkle on 3/4/19. | |
// Copyright © 2019 Zombie Dolphin LLC. All rights reserved. | |
// | |
// Works with iOS 12 | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func drawOnPDF(path: String) { | |
// Get existing Pdf reference | |
let pdf = CGPDFDocumentCreateWithURL(NSURL(fileURLWithPath: path)) | |
// Get page count of pdf, so we can loop through pages and draw them accordingly | |
let pageCount = CGPDFDocumentGetNumberOfPages(pdf); | |
// Write to file | |
UIGraphicsBeginPDFContextToFile(path, CGRectZero, nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
font-family: "Consolas"; | |
font-size: 11pt; | |
background-color: #1A1A1A; | |
color: #F9F9F9; | |
padding: 0; | |
margin: 0; | |
} | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FAILURE | |
var array = [["name": "glen"]] | |
for item in array { | |
item["rank"] = "advanced" // Generates an @lvalue error | |
} | |
// Even though array is immutable, it's of type <Array<Dictionary<String,String>>, | |
// item is assigned by let automatically. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $hashref; | |
method_that_returns_promise | |
->then(sub { | |
$hashref = shift; | |
return 1; | |
}) | |
->then(sub { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import CoreData | |
class PresentationsListVC: UIViewController { | |
@IBOutlet weak var collectionView: UICollectionView? | |
// UICollectionView doesn't do beginUpdates/endUpdates. | |
// CoreData modifications are stored in here and performed together |
NewerOlder