Skip to content

Instantly share code, notes, and snippets.

View ambas's full-sized avatar
🤔
🥺

Ambas Chobsanti ambas

🤔
🥺
View GitHub Profile
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto
@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@justinmfischer
justinmfischer / combineDateWithTime
Last active October 6, 2021 13:22
Combine date and time into a single NSDate in Swift 2.0
func combineDateWithTime(date: NSDate, time: NSDate) -> NSDate? {
let calendar = NSCalendar.currentCalendar()
let dateComponents = calendar.components([.Year, .Month, .Day], fromDate: date)
let timeComponents = calendar.components([.Hour, .Minute, .Second], fromDate: time)
let mergedComponments = NSDateComponents()
mergedComponments.year = dateComponents.year
mergedComponments.month = dateComponents.month
mergedComponments.day = dateComponents.day
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos

@adamgibbons
adamgibbons / install-mongodb.md
Last active January 17, 2023 15:17
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

@mmick66
mmick66 / UICollectionViewFlowLayoutCenterItem.m
Last active August 2, 2022 10:06
UICollectionViewFlowLayout with arbitrary sized Paging
#import "UICollectionViewFlowLayoutCenterItem.h"
@implementation UICollectionViewFlowLayoutCenterItem
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGSize collectionViewSize = self.collectionView.bounds.size;
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f;
CGRect proposedRect = self.collectionView.bounds;
@lukeredpath
lukeredpath / UITextField+RACKeyboardSupport.m
Last active April 19, 2017 10:36
ReactiveCocoa signal for keyboard done button taps
#import "UITextField+RACKeyboardSupport.h"
#import <ReactiveCocoa/RACEXTScope.h>
#import <ReactiveCocoa/NSObject+RACDescription.h>
@implementation UITextField (RACKeyboardSupport)
- (RACSignal *)rac_keyboardReturnSignal {
@weakify(self);
return [[[[RACSignal
defer:^{
@iwasrobbed
iwasrobbed / gist:5528897
Last active June 5, 2020 20:34
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;