Skip to content

Instantly share code, notes, and snippets.

Avatar

Federico Cappelli federicocappelli

  • Mimecast ltd
  • London
View GitHub Profile
View xcodeselect.sh
#!/bin/bash
#author Federico Cappelli - github.com/federicocappelli - 2021
if [ "$1" = "-h" ] || [ "$1" = "" ]; then
echo
echo "Select the command line tools for a specific Xcode version"
echo "Please place your Xcodes in /Applications or ~/Applications and name them like Xcode_10.3.app"
echo "examples:"
echo "./xcodeselect.sh 11"
echo "./xcodeselect.sh 10.3"
View gist:7f61d6bc2095cbc278df12519b721435
/*
* Toshiba T1000 Keyboard interpreter
*
* Converts signals from a T1000 keyboard's key matrix to a stndard USB keyboard when using a Teensy LC.
*
* 2017 Chad Boughton
*/
#include <Keypad.h>
@federicocappelli
federicocappelli / .swift
Created Feb 21, 2018
iOS Error management snippet 2
View .swift
func getDataFromUrl(url: URL, completion:(_ data: Data?, _ error: NSError?) -> Void) {
...
if (error) {
// Show error in UIAlertcontroller
//or
//send it up with a delegate/completion block to the higher level of the app.
}
else if (data) {
// Do something
}
@federicocappelli
federicocappelli / swift
Created Feb 21, 2018
iOS Error management snippet 1
View swift
func getDataFromUrl(url: URL, completion:(_ data: Data?, _ response: URLResponse?, _ error: NSError?) -> Void) {
...
if (data) {
// Do something
}
...
}