Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Ennio Masi ennioma

Block or report user

Report or block ennioma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d8832632d0022c7d6b2a94e8b05817ca
func stopSession() {
if let reader = reader {
reader.invalidate()
}
}
View gist:e4e0bcb457ea30ba4eb6a032dbf89846
override func viewDidLoad() {
super.viewDidLoad()
let reader = NFCNDEFReaderSession.init(delegate: self, queue: nil, invalidateAfterFirstRead: false) //1
reader.begin() //2
}
View gist:2a72a5cb467046f7edd628e2245e558f
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {
print(error.localizedDescription)
}
View gist:0fa9442e1d8da60590714c18f1b507bd
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {
for message in messages {
for record in message.records {
print("Record Type Id \(record.typeNameFormat)")
print("Record Type \(record.type)")
print("Record Payload \(record.payload)")
print("Record Identifier \(record.identifier)")
}
}
}
View Arek Inject Configuration
import UIKit
import arek
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let config = ArekConfiguration(frequency: .JustOnce, presentInitialPopup: true, presentReEnablePopup: true)
@ennioma
ennioma / OAuth2_doorkeeper_AFOAuth2Manager
Created Mar 6, 2015
OAuth2 using doorkeeper + AFOAuth2Manager
View OAuth2_doorkeeper_AFOAuth2Manager
/*
https://github.com/gottfrois/doorkeeper-provider-app
curl -i http://localhost:5100/oauth/token -F grant_type="password" -F username="john.smith@myapp.com" -F password="please" -F client_id="5c13e1fdd1007229121176ec372e5d9cda2698f37f243a3965c1176bce1ecd01" -F client_secret=","
*/
NSString *kClientID = @"5c13e1fdd1007229121176ec372e5d9cda2698f37f243a3965c1176bce1ecd01";
NSString *kClientSecret = @"40dfdc7edad96c219a8c948c228eda262a561774be74b8fc0996d9e57f62b771";
NSURL *baseURL = [NSURL URLWithString:@"http://localhost:5100"];
AFOAuth2Manager *OAuth2Manager =
@ennioma
ennioma / iBeaconAdvertising
Created Jun 10, 2014
Turn On iBeacon Advertising
View iBeaconAdvertising
- (void)advertise
{
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:kSomeUUID major:1 minor:1 identifier:kSomeId];
NSDictionary *beaconPeripheralData = [region peripheralDataWithMeasuredPower:nil];
[self.peripheralManager startAdvertising:beaconPeripheralData];
NSLog(@"Advertising on for the region: %@.", region);
}
You can’t perform that action at this time.