Skip to content

Instantly share code, notes, and snippets.

View rshev's full-sized avatar

Roman Shevtsov rshev

View GitHub Profile
@rshev
rshev / sleep_eject
Created October 5, 2015 15:12
Sleep and remount scripts for use with SD cards on MBPr
#!/bin/sh
volumeName="sdextend"
volume=`mount | grep "$volumeName" | sed 's/.*\(disk[0-9]s.\).*/\1/'`
if [ -n "$volume" ]; then
# force quit apps here
/usr/sbin/diskutil unmount force $volume
/usr/sbin/diskutil eject $volume
@rshev
rshev / portrait_with_rotatable_players.swift
Last active August 29, 2015 14:21
Portrait app with rotatable players
//AppDelegate:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
var presentedVC = application.keyWindow?.rootViewController
while let pVC = presentedVC?.presentedViewController
{
presentedVC = pVC
}
if let pVC = presentedVC
{