Skip to content

Instantly share code, notes, and snippets.

alberto elpsk

View GitHub Profile
@elpsk
elpsk / .swiftlint.yml
Last active Apr 20, 2019
My swift rules for .swiftlint.yml
View .swiftlint.yml
analyzer_rules:
- unused_import
- unused_private_declaration
opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- contains_over_first_not_nil
@elpsk
elpsk / android-screenshot.sh
Created Oct 5, 2018
Take a screenshot from Android connected device and save to macOS Desktop
View android-screenshot.sh
$ adb shell screencap -p /sdcard/screencap.png
$ adb pull /sdcard/screencap.png /Users/pippo/Desktop/test.png
@elpsk
elpsk / android tap
Created Oct 5, 2018
Android send tap on screen
View android tap
$ adb shell input tap x y
@elpsk
elpsk / screen.sh
Created Oct 5, 2018
MacOS programmatically take screenshot of a particular windows
View screen.sh
$ /usr/sbin/screencapture
-r
-l$(osascript -e 'tell app "QuickTime Player" to id of window 1')
/Users/pippo/Desktop/test.png
@elpsk
elpsk / voiceOver
Created Sep 28, 2018
Swift - Voice over detection
View voiceOver
//
// VoiceOverVC.swift
// Created by Pasca Alberto, IT on 10/08/18.
// Copyright © 2018 albertopasca.it. All rights reserved.
//
import UIKit
class VoiceOverVC: UIViewController {
@elpsk
elpsk / lowpower
Created Sep 28, 2018
Swift - detect low power
View lowpower
//
// LowPowerVC.swift
// Created by Pasca Alberto, IT on 10/08/18.
// Copyright © 2018 albertopasca.it. All rights reserved.
//
import UIKit
class LowPowerVC: UIViewController {
@elpsk
elpsk / pasteboard
Created Sep 28, 2018
Swift - pasteboard
View pasteboard
//
// PasteboardVC.swift
// Created by Pasca Alberto, IT on 10/08/18.
// Copyright © 2018 albertopasca.it. All rights reserved.
//
import UIKit
class PasteboardVC: UIViewController {
@elpsk
elpsk / proximity
Created Sep 28, 2018
Swift - Proximity sensor (shut down screen if near ear)
View proximity
//
// ProximityVC.swift
// Created by Pasca Alberto, IT on 10/08/18.
// Copyright © 2018 albertopasca.it. All rights reserved.
//
import UIKit
class ProximityVC: UIViewController {
@elpsk
elpsk / fontsize.swift
Created Sep 28, 2018
Swift - Detect device font size
View fontsize.swift
//
// FontSizeVC.swift
// Created by Pasca Alberto, IT on 10/08/18.
// Copyright © 2018 albertopasca.it. All rights reserved.
//
import UIKit
class FontSizeVC: UIViewController {
@elpsk
elpsk / shake
Created Sep 28, 2018
Swift - Undo text using Shake
View shake
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
if motion == .motionShake {
if (<#textField#>.undoManager?.canUndo)! {
self.<#textField#>.undoManager?.undo()
}
}
}
You can’t perform that action at this time.