Skip to content

Instantly share code, notes, and snippets.

View albertodebortoli's full-sized avatar
👶

Alberto De Bortoli albertodebortoli

👶
View GitHub Profile
### Keybase proof
I hereby claim:
* I am albertodebortoli on github.
* I am albertodebortoli (https://keybase.io/albertodebortoli) on keybase.
* I have a public key whose fingerprint is 40AC D3BB CE5F 75CC 3836 9084 BF11 3F8F 2F64 3DCA
To claim this, I am signing this object:
@albertodebortoli
albertodebortoli / simulator_populator_xcode7
Created November 5, 2015 00:27 — forked from cabeca/simulator_populator_xcode7
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|
@albertodebortoli
albertodebortoli / futures_and_promises_brainstorming.m
Created November 30, 2015 11:59
Futures & Promises brainstorming
[self job1].continueWith(^{
return [self job2];
}).continueWith(^{
return [self job3];
})
[JEPromise executeWaterfall(^{
return [self job1].[self job2].[self job3];
}).finally(^(JEFuture *fut){
@albertodebortoli
albertodebortoli / debounce.swift
Last active March 4, 2018 16:00 — forked from ShamylZakariya/debounce.swift
Simple Swift Debouncer
func debounce( delay:NSTimeInterval, #queue:dispatch_queue_t, action: (()->()) ) -> ()->() {
var lastFireTime:dispatch_time_t = 0
let dispatchDelay = Int64(delay * Double(NSEC_PER_SEC))
return {
lastFireTime = dispatch_time(DISPATCH_TIME_NOW,0)
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
let s: String = "Stack Overflow"
let ss1: String = (s as NSString).substring(to: 5) // "Stack"
let index: String.Index = s.index(s.startIndex, offsetBy: 5)
var ss2: String = s.substring(to: index) // "Stack"
@albertodebortoli
albertodebortoli / Protocolling in Swift
Last active January 28, 2018 17:36
Playing around w/ protocols in Swift
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
import UIKit
protocol HomeViewControllerProtocol: class {
func render()
}
@albertodebortoli
albertodebortoli / postal-codes.json
Created February 9, 2018 21:23 — forked from matthewbednarski/postal-codes.json
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$"}, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$"}, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$"}, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$"}, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$"}, { "Note":
$ brew install imagemagick
$ convert UK-iPad*.png -resize 50% -set filename:fname '%t_Resized' +adjoin '%[filename:fname].png'
credits to Oliver Pearmain
@albertodebortoli
albertodebortoli / multiple_ssh_setting.md
Created June 9, 2018 19:28 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@albertodebortoli
albertodebortoli / TweakManager_stack_sample.swift
Last active November 28, 2019 11:19
used by 'A Smart Feature Flagging System for iOS' article on Medium
static let tweakManager: TweakManager = {
// mutable configuration (to override tweaks from other configurations)
let userDefaultsConfiguration = UserDefaultsConfiguration(userDefaults: .standard)
// remote configurations (optional)
let optimizelyConfiguration = OptimizelyConfiguration()
let firebaseConfiguration = FirebaseConfiguration()
// local JSON configuration (default tweaks)
let jsonFileURL = Bundle.main.url(forResource: "ExampleConfiguration", withExtension: "json")!