Skip to content

Instantly share code, notes, and snippets.

Avatar

Julian Hays jhays

View GitHub Profile
@jhays
jhays / BluetoothManager.swift
Created Jun 4, 2020
A comparison of reading from a BLE peripheral using the CoreBluetooth standard delegation pattern, and RxBluetoothKit's reactive pattern. Notice the difference in total lines of code to accomplish a single read...
View BluetoothManager.swift
//
// BluetoothManager.swift
// BluetoothExample
//
// Created by Julian Hays on 5/26/20.
// Copyright © 2020 PunchThrough. All rights reserved.
//
import Foundation
import CoreBluetooth
@jhays
jhays / characteristic.js
Created Oct 17, 2019
A sample BLE peripheral service and characteristic for use with Node.js and bleno.
View characteristic.js
/* characteristic.js
* A simple custom BLE peripheral characteristic for use with Node.js and bleno.
* This characteristic supports read, write, and notify properties.
* Julian Hays - 10/14/19
*/
var util = require('util');
var bleno = require('bleno-mac'); //or 'bleno-mac' if you are using that
var BlenoCharacteristic = bleno.Characteristic;
@jhays
jhays / jhspinner.playground
Created Oct 6, 2017
JHSpinner Swift Playground
View jhspinner.playground
import UIKit
import PlaygroundSupport
class JHSpinner : UIView {
private let containerView = UIView()
private let line1 = UIView()
private let line2 = UIView()
private let line3 = UIView()
@jhays
jhays / JHGradientView.swift
Last active Jun 14, 2019
GradientView - Editable in Interface Builder
View JHGradientView.swift
//
// JHGradientView.swift
// Gradient View editable in Interface Builder
//
// Created by JHays on 2/20/15.
// Copyright (c) 2015 Orbosphere. All rights reserved.
//
import Foundation
import UIKit
@jhays
jhays / ParallaxShaderViewExtension.swift
Last active Jan 29, 2020
UIKit Motion / Shadow Effects Helper
View ParallaxShaderViewExtension.swift
import UIKit
import Foundation
extension UIView {
/// Adds a shadow to the layer of a view.
func addShadow(color: UIColor = .black,
opacity: Float = 0.4,
radius: Float = 3.0,
offset: CGSize = CGSize(width:0, height:2)
@jhays
jhays / DMGradientButton.swift
Created Feb 23, 2015
IBDesignable Gradient Button
View DMGradientButton.swift
//
// GradientButton.swift
// practice
//
// Created by Julian Hays on 2/18/15.
// Copyright (c) 2015 DevMode. All rights reserved.
//
import Foundation
import UIKit
@jhays
jhays / UIView+Parallax.h
Last active Aug 29, 2015
UIView+Parallax Category For Easy Parallax and Shadow Movement
View UIView+Parallax.h
//
// UIView+Parallax.h
// Orbosphere
//
// Created by Julian Hays on 4/22/14.
// Inspired By Ash Furrow - http://www.teehanlax.com/blog/introduction-to-uimotioneffect/ - September 19,2013
// and Michael Burford - http://michael.burford.net/2013/10/ios7-parallax-shadows.html - Thursday, October 10, 2013
//
//