Skip to content

Instantly share code, notes, and snippets.

@jochenschoellig
jochenschoellig / ChatCollectionViewFlowLayout.swift
Created January 19, 2017 15:49
A subclass of UICollectionViewFlowLayout to get chat behavior without turning collection view upside-down. This layout is written in Swift 3 and absolutely usable with RxSwift and RxDataSources because UI is completely separated from any logic or binding.
import UIKit
class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout {
private var topMostVisibleItem = Int.max
private var bottomMostVisibleItem = -Int.max
private var offset: CGFloat = 0.0
private var visibleAttributes: [UICollectionViewLayoutAttributes]?
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active April 22, 2024 17:19
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@kaiinui
kaiinui / v.swift
Created June 18, 2014 07:33
Infinite Scroll with UICollectionView in Swift
import UIKit
class ViewController: UICollectionViewController, UICollectionViewDataSource, UICollectionViewDelegate {
override func collectionView(collectionView: UICollectionView!, numberOfItemsInSection section: Int) -> Int {
...
}
override func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell! {
...
}
@vgrichina
vgrichina / CellBackgroundView.h
Created November 12, 2012 21:39
Customizable background view for UITableViewCell in grouped table view
//
// CellBackgroundView.h
//
//
#import <UIKit/UIKit.h>
typedef enum {
CellPositionTop,
CellPositionMiddle,