Skip to content

Instantly share code, notes, and snippets.

View sger's full-sized avatar

Spiros Gerokostas sger

View GitHub Profile
import UIKit
final class ReusableCollectionViewDataSource<T, V>: NSObject,
UICollectionViewDataSource where V: ReusableCollectionViewCell<T> {
typealias ConfigureCell = (T, V) -> Void
var models: [T]
private let configureCell: ConfigureCell
@sger
sger / unit_test.yml
Last active March 24, 2020 07:21
Unit Tests
jobs:
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=13.3,name=iPhone 11']
steps:
- name: Checkout
uses: actions/checkout@master
@sger
sger / jobs.yml
Last active March 24, 2020 07:16
Jobs
jobs:
lint:
test:
needs: lint
build:
needs: [lint, test]
@sger
sger / basic_workflow.yml
Last active March 24, 2020 07:17
Basic workflow
name: CI
on:
pull_request:
push:
branches:
- develop
- feature/*
- master
import UIKit
extension UIImage {
class func imageWithColor(color: UIColor, size: CGSize=CGSize(width: 1, height: 1)) -> UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0)
color.setFill()
UIRectFill(CGRect(origin: CGPoint.zero, size: size))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image!
@sger
sger / RxSwift
Created December 11, 2018 16:05
let subject: PublishSubject<Void> = PublishSubject()
lazy private(set) var items: Observable<[Item]> = self.setupItems()
fileprivate func setupItems() -> Observable<[Item]> {
return self.reloadTrigger
.asObservable()
.debounce(0.3, scheduler: MainScheduler.instance)
.flatMapLatest { (_) -> Observable<[Film]> in
return API.instance.FetchItems()
}
enum Action {
case UpdateLocation
case FailWithError
}
func updateLocationAction()->Observable<CLLocation> {
return create { observer in
self.locationManager.rx_didUpdateLocations.take(1).subscribe { event in
switch event {
case .Next(let value):
@sger
sger / RCA
Last active October 7, 2015 05:26
ReactiveCocoa for Xcode 7
$ git submodule add https://github.com/ReactiveCocoa/ReactiveCocoa
$ cd ReactiveCocoa
$ checkout swift2
$ script/bootstrap
language: objective-c
osx_image: xcode7
script:
- xctool -workspace TestTravis.xcworkspace -scheme TestTravis -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
- xctool test -workspace TestTravis.xcworkspace -scheme TestTravisTests -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
before_install:
- gem i cocoapods --no-ri --no-rdoc
- gem i slather --no-ri --no-rdoc
@sger
sger / gist:6e254566fbb97b8f5c6e
Last active September 17, 2015 10:28 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan Developer Preview 2

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat