Skip to content

Instantly share code, notes, and snippets.

View benjohnde's full-sized avatar
brewing code all day long

Ben John benjohnde

brewing code all day long
View GitHub Profile
@benjohnde
benjohnde / Channel.swift
Created March 27, 2018 08:04 — forked from gokselkoksal/Channel.swift
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil
// without turtle drawing a hexagon is math heavy and not trivial to modify
let numberOfSides: CGFloat = 6
let radiusOuterCircle: CGFloat = 30
let sideLength = radiusOuterCircle / 2
let theta = (CGFloat.pi * 2) / numberOfSides
let centerX = sideLength / 2
let centerY = sideLength / 2
let initialPoint = CGPoint(x: radiusOuterCircle * cos(2 * CGFloat.pi * 0/numberOfSides + theta) + centerX, y: radiusOuterCircle * sin(2 * CGFloat.pi * 0/numberOfSides + theta) + centerX)
@benjohnde
benjohnde / check-provisioning-udid.sh
Last active January 8, 2018 10:32 — forked from akofman/checkIosProvisiongProfile.md
Check for device(s) in a provisioning profile.
unzip -oq IDQuantOnCalDemo.ipa
security cms -Di Payload/IDQuantOnCalDemo.app/embedded.mobileprovision > mobileprovision.plist
/usr/libexec/PlistBuddy -c "Print :ProvisionedDevices" mobileprovision.plist > provisioneddevices.txt
@benjohnde
benjohnde / example
Created May 23, 2016 06:58 — forked from cedricwalter/example
Nginx configuration for JIRA, TeamCity, Nexus or any other Tomcat web application
## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application
#
# author cedric.walter, www.waltercedric.com
# to be saved for ex in /etc/nginx/sites-available/example
server {
listen 80;
server_name jira.example.com;
access_log off;
location / {