Skip to content

Instantly share code, notes, and snippets.

View jhays's full-sized avatar

Julian Hays jhays

View GitHub Profile
@jhays
jhays / UIView+Parallax.h
Last active August 29, 2015 14:00
UIView+Parallax Category For Easy Parallax and Shadow Movement
//
// 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
//
//
@jhays
jhays / jhspinner.playground
Created October 6, 2017 16:36
JHSpinner Swift 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 June 14, 2019 07:22
GradientView - Editable in Interface Builder
//
// 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 January 29, 2020 22:22
UIKit Motion / Shadow Effects Helper
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 February 23, 2015 23:37
IBDesignable Gradient Button
//
// GradientButton.swift
// practice
//
// Created by Julian Hays on 2/18/15.
// Copyright (c) 2015 DevMode. All rights reserved.
//
import Foundation
import UIKit
@jhays
jhays / BluetoothManager.swift
Created June 4, 2020 15:36
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...
//
// 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 October 17, 2019 19:05
A sample BLE peripheral service and characteristic for use with Node.js and bleno.
/* 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;