Skip to content

Instantly share code, notes, and snippets.

@jeantimex
jeantimex / numberOfRowsInSection.swift
Last active July 19, 2017 19:06
numberOfRowsInSection
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return sections[section].collapsed ? 0 : sections[section].items.count
}
@jeantimex
jeantimex / toggleSection.swift
Last active July 19, 2017 19:07
toggleSection
extension CollapsibleTableViewController: CollapsibleTableViewHeaderDelegate {
func toggleSection(_ header: CollapsibleTableViewHeader, section: Int) {
let collapsed = !sections[section].collapsed
// Toggle collapse
sections[section].collapsed = collapsed
header.setCollapsed(collapsed)
// Reload the whole section
tableView.reloadSections(NSIndexSet(index: section) as IndexSet, with: .automatic)
@jeantimex
jeantimex / iterm2-solarized.md
Created July 27, 2017 17:58 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@jeantimex
jeantimex / PromisAllWithFails.js
Created August 21, 2018 22:05 — forked from nhagen/PromisAllWithFails.js
Wait until all promises have completed even when some reject, with Promise.all
var a = ["sdfdf", "http://oooooolol"],
handleNetErr = function(e) { return e };
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr))
.then(function(sdf, invalid) {
console.log(sdf, invalid) // [Response, TypeError]
})
.catch(function(err) {
console.log(err);
})
@jeantimex
jeantimex / SwiftyLib.swift
Last active February 24, 2019 18:53
SwiftyLib.swift
//
// SwiftyLib.swift
//
public final class SwiftyLib {
let name = "SwiftyLib"
public func add(a: Int, b: Int) -> Int {
return a + b
@jeantimex
jeantimex / SwiftyLibTests.swift
Created February 24, 2019 19:16
SwiftyLibTests.swift - Part 1
//
// SwiftyLibTests.swift
//
import XCTest
@testable import SwiftyLib
class SwiftyLibTests: XCTestCase {
var swiftyLib: SwiftyLib!
@jeantimex
jeantimex / SwiftyLibTests-complete.swift
Last active February 24, 2019 19:29
SwiftyLibTests.swift
//
// SwiftyLibTests.swift
//
import XCTest
@testable import SwiftyLib
class SwiftyLibTests: XCTestCase {
var swiftyLib: SwiftyLib!
@jeantimex
jeantimex / SwiftyLib basic .travis.yml
Last active February 24, 2019 21:12
SwiftyLib .travis.yml file
language: objective-c
osx_image: xcode10.1
env:
matrix:
- TEST_SDK=iphonesimulator12.1 OS=12.1 NAME='iPhone XR'
- TEST_SDK=iphonesimulator12.1 OS=12.1 NAME='iPhone 7'
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -project SwiftyLib.xcodeproj -scheme SwiftyLib -sdk $TEST_SDK -destination "platform=iOS Simulator,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES
@jeantimex
jeantimex / .slather.yml
Created February 24, 2019 22:45
.slather.yml
coverage_service: cobertura_xml
xcodeproj: SwiftyLib.xcodeproj
scheme: SwiftyLib
output_directory: reports
ignore:
- SwiftyLibTests/*
@jeantimex
jeantimex / .travis.yml with slater
Last active February 24, 2019 22:50
.travis.yml with slater
language: objective-c
osx_image: xcode10.1
env:
matrix:
- TEST_SDK=iphonesimulator12.1 OS=12.1 NAME='iPhone XR'
- TEST_SDK=iphonesimulator12.1 OS=12.1 NAME='iPhone 7'
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -project SwiftyLib.xcodeproj -scheme SwiftyLib -sdk $TEST_SDK -destination "platform=iOS Simulator,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES