This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CrossStoryboardSegue.h | |
// | |
#import <UIKit/UIKit.h> | |
@interface CrossStoryboardSegue : UIStoryboardSegue | |
// Default: YES | |
@property (nonatomic, assign) BOOL animatedSegue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resultText; | |
function run(){ | |
var layerSets = app.activeDocument.layerSets; | |
dumpLayerSets(layerSets); | |
dumpLayers(app.activeDocument.layers); | |
} | |
function dumpLayerSets(layerSets){ | |
var len = layerSets.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Store path: %userprofile%/Documents/AutoHotkey.ahk | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; | |
; Keyboard layout swithing | |
; | |
; See the language identifiers list here: | |
; http://msdn.microsoft.com/en-us/library/dd318693%28v=vs.85%29.aspx | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Krin-San's remapping</name> | |
<item> | |
<name>Use F19 as non-cycle layout switching</name> | |
<appendix>Install Seil plugin to override CapsLock (https://pqrs.org/osx/karabiner/seil.html.en)</appendix> | |
<identifier>change_inputsources</identifier> | |
<autogen>__KeyToKey__ KeyCode::F19, ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen> | |
<autogen>__KeyToKey__ KeyCode::F19, ModifierFlag::OPTION_L, KeyCode::VK_CHANGE_INPUTSOURCE_RUSSIAN</autogen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from http://www.slideshare.net/manuelmaly/reactivecocoa-goodness-part-i-of-ii | |
// Exact presentation slide: http://image.slidesharecdn.com/presentation-141009165841-conversion-gate01/95/reactivecocoa-goodness-part-i-of-ii-37-638.jpg?cb=1412892113 | |
// Try to repeat signal 3 times | |
static NSUInteger const retryAttempts = 2; | |
static NSTimeInterval const retrydelay = 1.; | |
RACSignal *signal = ...; | |
RACSignal *result = [[signal catch:^RACSignal *(NSError *error) { | |
return [[[RACSignal empty] delay:retrydelay] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AddressBook/AddressBook.h> | |
... | |
void (^addContacts)(NSInteger) = ^(NSInteger count){ | |
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL); | |
dispatch_semaphore_t sema = dispatch_semaphore_create(0); | |
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { | |
dispatch_semaphore_signal(sema); | |
}); | |
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSDate doesn't include overrides for standard comparison operators in Swift. | |
// This extension adds <, >, <=, >=, and ==, using NSDate's built-in `compare` method. | |
// MIT licensed. | |
func <=(lhs: NSDate, rhs: NSDate) -> Bool { | |
return lhs.compare(rhs) != .OrderedDescending | |
} | |
func >=(lhs: NSDate, rhs: NSDate) -> Bool { | |
return lhs.compare(rhs) != .OrderedAscending | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define INC_SYSTEM_VERSION(v) ((NSOperatingSystemVersion){v.majorVersion, v.minorVersion + 1, 0}) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:v] | |
#define SYSTEM_VERSION_LESS_THAN(v) (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)) | |
#define SYSTEM_VERSION_EQUAL_TO(v) (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) && (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(INC_SYSTEM_VERSION(v)))) | |
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) (SYSTEM_VERSION_LESS_THAN(v) || SYSTEM_VERSION_EQUAL_TO(v)) | |
#define SYSTEM_VERSION_GREATER_THAN(v) (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) && (!SYSTEM_VERSION_EQUAL_TO(v))) | |
/* | |
// Manual logical check | |
NSOperatingSystemVersion v = (NSOperatingSystemVersion){8, 4, 0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:beep frequency=264 length=250ms; | |
:delay 500ms; | |
:beep frequency=264 length=250ms; | |
:delay 250ms; | |
:beep frequency=297 length=1000ms; | |
:delay 250ms; | |
:beep frequency=264 length=1000ms; | |
:delay 250ms; | |
:beep frequency=352 length=1000ms; | |
:delay 250ms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift version of the code from http://stackoverflow.com/a/30335594/1986600 | |
import CoreTelephony | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
let isCapableToCall: Bool | |
if UIApplication.sharedApplication().canOpenURL(NSURL(string: "tel://")!) { | |
// Check if iOS Device supports phone calls |
OlderNewer