Skip to content

Instantly share code, notes, and snippets.

Dennis Oberhoff docterd

Block or report user

Report or block docterd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kravik
kravik / detect-text.swift
Last active Feb 1, 2019
iOS 11 Vision. Text detection
View detect-text.swift
let image = UIImage(named: "text.png")!
let vnImage = VNImageRequestHandler(cgImage: image.cgImage!, options: [:])
let textRectsRequest = VNDetectTextRectanglesRequest { (request, error) in
if let results = request.results as? [VNTextObservation] {
for result in results {
print("boundingBox \(result.boundingBox)")
print("characterBoxes \(result.characterBoxes)")
}
}
}
@cemolcay
cemolcay / ArcTextLayer.swift
Created Jan 22, 2017
Draws a curved string on a CALayer with angle, radius and text that you give.
View ArcTextLayer.swift
import UIKit
// swift port of stackoverflow answer
// http://stackoverflow.com/a/31301238/2048130
extension CGFloat {
/** Degrees to Radian **/
var degrees: CGFloat {
return self * (180.0 / .pi)
}
@steipete
steipete / gist:d9b44d8e9f341e81414e86d7ff8fb62d
Last active Jul 23, 2019
Using iOS 13 devices with Xcode 10.2 (instead of Xcode 11)
View gist:d9b44d8e9f341e81414e86d7ff8fb62d
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.2 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
@pkuecuekyan
pkuecuekyan / SearchContainerInTabBar.swift
Last active Apr 26, 2017
Set up a UISearchContainerViewController inside a UITabBar for tvOS 9
View SearchContainerInTabBar.swift
func setupTabBarWithSearchContainerView() {
// configure a UIViewController to display search results
// needs to conform to the UISearchResultsUpdating protocol
let searchResultsViewController = SearchResultsViewController()
// setup UISearchController and hook up to search results UIViewController
let searchController = UISearchController(searchResultsController: searchResultsViewController)
searchController.searchResultsUpdater = searchResultsViewController
searchController.hidesNavigationBarDuringPresentation = false
View Bearing.swift
/**
Calculate initial compass bearing between two locations
- parameter fromLocation: Source Location
- parameter toLocation: Destination Location
- returns: bearing (CLLocationDirection)
*/
private func bearingFromLocation(fromLocation: CLLocation, toLocation: CLLocation) -> CLLocationDirection {
@mackuba
mackuba / wwdc15.md
Last active Jul 7, 2019
New stuff from WWDC 2015
View wwdc15.md

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
View deploy.prototxt
name: "GoogleNet"
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
# hierarchy 1
# conv -> relu -> pool -> lrn
@nicklockwood
nicklockwood / Hacking UIView Animation Blocks.md
Last active May 17, 2019
This article was originally written for objc.io issue 12, but didn't make the cut. It was intended to be read in the context of the other articles, so if you aren't familiar with concepts such as CALayer property animations and the role of actionForKey:, read the articles in that issue first.
View Hacking UIView Animation Blocks.md

Hacking UIView animation blocks for fun and profit

In this article, I'm going to explore a way that we can create views that implement custom Core Animation property animations in a natural way.

As we know, layers in iOS come in two flavours: Backing layers and hosted layers. The only difference between them is that the view acts as the layer delegate for its backing layer, but not for any hosted sublayers.

In order to implement the UIView transactional animation blocks, UIView disables all animations by default and then re-enables them individually as required. It does this using the actionForLayer:forKey: method.

Somewhat strangely, UIView doesn't enable animations for every property that CALayer does by default. A notable example is the layer.contents property, which is animatable by default for a hosted layer, but cannot be animated using a UIView animation block.

View Maths.swift
// See: https://devforums.apple.com/message/1000934#1000934
import Foundation
// Logic
operator prefix ¬ {}
@prefix func ¬ (value: Bool) -> Bool {
return !value
}
@leplatrem
leplatrem / mbtiles_split.py
Created Jan 14, 2014
Split a big MBTiles into smaller ones, based on column index
View mbtiles_split.py
#!/usr/bin/env python
import os
import sys
import shutil
import subprocess
class UserError(Exception):
pass
You can’t perform that action at this time.