Skip to content

Instantly share code, notes, and snippets.

View jzucker2's full-sized avatar

Jordan Zucker jzucker2

  • PubNub
  • San Francisco
View GitHub Profile
@jzucker2
jzucker2 / Android.md
Created May 4, 2017 20:03
More info about Android Specifics
@jzucker2
jzucker2 / Annotations.md
Last active May 12, 2017 18:13
Learning Java

Annotations

  • Start with annotations here

Examples

@Entity

@Override
void mySuperMethod() { ... }
@jzucker2
jzucker2 / Python.md
Last active April 11, 2017 19:12
Python Data Dump

Info Dump for Python Work

Here's my guide for getting started using Python with virtualenv and pip

Quick Set Up Commands

  1. Navigate to directory
  2. virtualenv env
  3. source env/bin/activate

To end:

@jzucker2
jzucker2 / UIKit.md
Created March 31, 2017 18:44
UIKit Info Dump
@jzucker2
jzucker2 / Promises.md
Last active March 31, 2017 18:46
Info Dump on JS Promises
guard let googleURL = URL(string: "https://www.google.com") else {
fatalError("What went wrong?")
}
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { (_) in
let task = URLSession.shared.dataTask(with: googleURL) { (data, response, error) in
if error != nil {
// handle error
print(error.debugDescription);
} else {
do {
try ErrorGenerator.generateAlertControllerError()
} catch let showError as ExampleAlertControllerError where showError == .show {
show(alertControllerError: showError)
} catch {
fatalError(error.localizedDescription)
}
@jzucker2
jzucker2 / Toolkit.swift
Created February 9, 2017 17:03
Beginnings of useful Swift snippets
// http://stackoverflow.com/questions/26542035/create-uiimage-with-solid-color-in-swift
public extension UIImage {
public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) {
let rect = CGRect(origin: .zero, size: size)
UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0)
color.setFill()
UIRectFill(rect)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
@jzucker2
jzucker2 / Notifier.swift
Last active February 9, 2017 17:24
Proper KVO in Swift
import Foundation
class Foo: NSObject {
dynamic var bar: Int = 0
private let bazKeyPath = #keyPath(Foo.baz)
private var _baz: Int = 0 {
set {
willChangeValue(forKey: bazKeyPath)
self._baz = newValue
@jzucker2
jzucker2 / HighPacketLoss.md
Last active March 28, 2018 23:48
How to deal with high packet loss

High Packet Loss Mitigation

PubNub is real time, with less than 250 milliseconds latency anywhere in the world. However, even though PubNub is low latency, a device's actual physical connection to the Internet could be extremely high latency, with 50% packet loss or more. In these cases, there are a set of best practices to adopt to help mitigate user issues.

Initializing PubNub client instance

In this case, we initialize the client instance with a shorter subscribe timeout so that if a