Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View federicocappelli's full-sized avatar

Federico Cappelli federicocappelli

View GitHub Profile
#!/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"
/*
* 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 February 21, 2018 11:05
iOS Error management snippet 2
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 February 21, 2018 11:01
iOS Error management snippet 1
func getDataFromUrl(url: URL, completion:(_ data: Data?, _ response: URLResponse?, _ error: NSError?) -> Void) {
...
if (data) {
// Do something
}
...
}