Skip to content

Instantly share code, notes, and snippets.

View acecilia's full-sized avatar

Andrés Cecilia Luque acecilia

View GitHub Profile
@acecilia
acecilia / create_simulator.sh
Last active February 2, 2022 23:36
Create a simulator with a specific ID
#!/bin/zsh
#
# To call this function, pass a valid simulator ID:
# > ./create_simulator.sh create_and_boot "00000000-0000-0000-0000-000000000000"
set -euo pipefail
readonly SIMULATOR="iPhone 8"
readonly SIMULATOR_RUNTIME="15.2"
readonly SIMULATOR_NAME="${SIMULATOR}"
@acecilia
acecilia / speed_test.sh
Created May 23, 2020 15:01
Script to demonstrate notarization requests on executing shell scripts: https://sigpipe.macromates.com/2020/macos-catalina-slow-by-design/
#!/bin/bash
rm -rf /tmp/speed_test
mkdir -p /tmp/speed_test
TIMEFORMAT="%R"
first_execution_time=0
second_execution_time=0
for i in {1..100};do
@acecilia
acecilia / pre-push-prevent-using-wrong-email
Last active April 28, 2020 17:23
A pre-push hook to prevent using the wrong email when pushing to a specific remote
#!/bin/sh
########################################
# A pre-push hook to prevent using the wrong email when pushing to a specific remote
#
# Setup:
# $ curl https://gist.githubusercontent.com/acecilia/f7eb2ba6b1b5d015e96a9a52f3f12480/raw --output ~/.githooks/pre-push
# $ chmod +x ~/.githooks/pre-push
#
# In your .gitconfig add the following under the [core] section:
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCell(
withIdentifier: cellIdentifier
) as? CustomCell ?? CustomCell(reuseIdentifier: cellIdentifier)
cell.customLabel.text = "Title"
return cell
// Crashing: force unwrapping
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "Cell", for: indexPath) as! CustomCell
cell.customLabel.text = "Title"
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(CustomCell.self, forCellReuseIdentifier: "Cell")
}
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "Cell", for: indexPath) as? CustomCell
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "Cell", for: indexPath)
cell.textLabel?.text = "Title"
return cell
}
@acecilia
acecilia / Fastfile
Last active April 25, 2018 17:07
Fastlane match with keychain removal
# If the match keychain is present, remove it
def remove_keychain_if_exists
delete_keychain(name: <keychainName>) if File.exist? File.expand_path "~/Library/Keychains/#{<keychainName>}-db" # The File.expand_path is crutial, otherwise File.exist? will not work!!!!!!!
end
keychainPassword = SecureRandom.base64(16) # We need a key for the keychain, so nobody can extract the certificates out while the build is happening
remove_keychain_if_exists
create_keychain(
@acecilia
acecilia / SearchResultsViewController.swift
Created June 12, 2016 23:46 — forked from gonzalezreal/SearchResultsViewController.swift
RxSwift slides – Code for the search sample
class SearchResultsViewController: UITableViewController {
// MARK: - Properties
private let viewModel: SearchResultsViewModelType
private let disposeBag = DisposeBag()
// MARK: - Initialization
init(viewModel: SearchResultsViewModelType = SearchResultsViewModel()) {