Skip to content

Instantly share code, notes, and snippets.

View kevinmlong's full-sized avatar

Kevin Long kevinmlong

View GitHub Profile
@kevinmlong
kevinmlong / UIViewController-UnocculdedTextField-Keyboard-Events.swift
Last active July 10, 2018 10:45
Unoccluded UITextField Extension (Keyboard Events)
import UIKit
import ObjectiveC
struct AssociatedKeys {
static var activeTextField: UInt8 = 0
static var keyboardHeight: UInt8 = 1
}
extension UIViewController : UITextFieldDelegate {
@kevinmlong
kevinmlong / UIViewController-UnocculdedTextField-TextField-Delegate.swift
Created July 9, 2018 12:46
Unoccluded UITextField Extension (Text Field Delegate)
import UIKit
import ObjectiveC
struct AssociatedKeys {
static var activeTextField: UInt8 = 0
}
extension UIViewController : UITextFieldDelegate {
private(set) var activeTextField: UITextField? {
@kevinmlong
kevinmlong / UIViewController-UnocculdedTextField-SimpleImplementation.swift
Last active July 10, 2018 10:46
Unoccluded UITextField Extension (Simple Implementation)
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.enableUnoccludedTextField()
}
override func viewWillDisappear(_ animated: Bool) {
@kevinmlong
kevinmlong / UIViewController-UnocculdedTextField-Full.swift
Last active December 15, 2019 18:38
Unoccluded UITextField Extension (Full Source)
import UIKit
import ObjectiveC
struct AssociatedKeys {
static var activeTextField: UInt8 = 0
static var keyboardHeight: UInt8 = 1
}
extension UIViewController : UITextFieldDelegate {
@kevinmlong
kevinmlong / UIViewController-UnocculdedTextField-Basic.swift
Created July 9, 2018 10:50
Unoccluded UITextField Extension (Basic Template)
import UIKit
extension UIViewController : UITextFieldDelegate {
// Put some useful code here
}
@kevinmlong
kevinmlong / example.php
Created June 1, 2017 15:09
Example Implementation for PHP Event Bus Using RabbitMQ
<?php
/**
* Example of PHP Script #1
*/
// Do some work...
// Need to send a message
// Create an instance of Postmaster
@kevinmlong
kevinmlong / letter.php
Created June 1, 2017 14:53
Letter Class for PHP Event Bus Using RabbitMQ
<?php
class Letter extends Parcel {
private $message = '';
public function setMessage($message){
$this->message = $message;
}
@kevinmlong
kevinmlong / abstract-parcel.php
Created June 1, 2017 14:46
Parcel Class for PHP Event Bus Using RabbitMQ
<?php
abstract class Parcel {
}
@kevinmlong
kevinmlong / letter-carrier.php
Last active June 1, 2017 14:55
LetterCarrier for PHP Event Bus Using RabbitMQ
<?php
class LetterCarrier extends AbstractCarrier {
public function __construct($queueName = , $host = 'localhost', $port = 5672, $username = 'guest', $password = 'guest') {
parent::__construct($queueName, $host, $port, $username, $password);
}
protected function receivedParcel($msg) {
/* @param AMQPMessage $msg */
@kevinmlong
kevinmlong / abstract-carrier.php
Last active June 1, 2017 14:15
AbstractCarrier Class for PHP Event Bus Using RabbitMQ
<?php
abstract class AbstractCarrier {
protected $connection;
protected $channel;
protected $queueName;
public function __construct($queueName, $host = 'localhost', $port = 5672, $username = 'guest', $password = 'guest') {
$this->queueName = $queueName;