Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lucianboboc on github.
  • I am lucianboboc (https://keybase.io/lucianboboc) on keybase.
  • I have a public key ASDeoz3SvKNaOUzUThpZWs6B-11PsRXXePnxFjVN8KSYhQo

To claim this, I am signing this object:

@lucianboboc
lucianboboc / pat.swift
Last active May 5, 2019 16:07
PAT used as type
class PersonCell: UICollectionViewCell {
@IBOutlet weak var firstLabel: UILabel!
@IBOutlet weak var secondLabel: UILabel!
}
struct Person {
let firstName: String
let lastName: String
}
@lucianboboc
lucianboboc / MessageFilterExtension.swift
Created October 7, 2017 21:36
Message Filter Extension
final class MessageFilterExtension: ILMessageFilterExtension {
var words:[Item] = []
let stack = CoreDataStack()
func loadItems() {
let context = stack.persistentContainer.viewContext
let itemDAO = ItemDAO(managedObjectContext: context)
let allItems = itemDAO.fetchItmes()
self.words = allItems.flatMap({ item in
return item.value != nil ? item : nil
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
if let error = error {
print(error.localizedDescription)
return
}
if !result.isCancelled {
let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
FIRAuth.auth()?.signIn(with: credential) { (user, error) in
if let error = error {
let connectionProperties = ConnectionProperties(host: "localhost", port: 5984, secured: false)
let client = CouchDBClient(connectionProperties: connectionProperties)
let database = client.database("test")
func test() {
let dict = ["key":"value"]
let json = JSON(dict)
database.create(json) { id, revision, doc, error in
if let id = id {
database.retrieve(id) { doc, error in
@lucianboboc
lucianboboc / _readme.md
Created December 26, 2016 11:50 — forked from maxivak/_readme.md
Vagrant with Ubuntu 16.04 in VirtualBox

Setup Ubuntu 16.04 to be used with Vagrant and Virtualbox

Prepare Vagrant box with Ubuntu 16.04

We will use official box "ubuntu/xenial64" and modify it to work with Vagrant.

  • Vagrantfile

Videos

func unregisterForNotificationsForApp(){
let application = UIApplication.sharedApplication()
application.unregisterForRemoteNotifications()
NSUserDefaults.standardUserDefaults().setBool(false, forKey: "pushPermissions")
}
func registerForNotificationsForApp(){
let userNotificationTypes = (UIUserNotificationType.Alert |
UIUserNotificationType.Badge |
UIUserNotificationType.Sound);
@lucianboboc
lucianboboc / gist:7ca703d40c6648cbce04
Created June 17, 2015 16:27
Use of undeclared type 'String'
extension LBJSON: Printable {
var description: String {
return "description"
}
}
@lucianboboc
lucianboboc / NSDataFromAssetRepresentation
Last active December 25, 2015 03:19
NSData From Asset Representation
- (NSData *) getDataFromAssetRepresentation: (ALAssetRepresentation *) representation
{
if(!representation)
{
NSLog(@"asset representation is NIL!");
return nil;
}
uint8_t *buffer = malloc(representation.size);
NSError *error = nil;