most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
document.addEventListener("dragstart", function(event) | |
{ | |
event.dataTransfer.setData("image/png", slides.imageRep()); | |
event.dataTransfer.setData("slides", slides.serializedRep()); | |
// etc. | |
}, false); |
public class Global extends GlobalSettings { | |
@Override | |
public Action onRequest(Request arg0, Method arg1) { | |
return new Action.Simple() { | |
public Result call(Context ctx) throws Throwable { | |
String authConf = Config.getString("basic.auth"); | |
if (authConf == null) | |
return delegate.call(ctx); | |
String auth = ctx.request().getHeader("Authorization"); |
After requesting the certificate from Apple, export your private key as a .p12 file and | |
download the .cer file (usually named aps_production.cer or aps_development.cer) from | |
the iOS Provisioning Portal. | |
Now, in the directory containing cert.cer and key.p12 execute the following commands to | |
generate your .pem files: | |
openssl x509 -in aps_development.cer -inform DER -outform PEM -out aps_development.pem |
@interface NSManagedObject (Serialization) | |
- (NSDictionary*) toDictionary; | |
- (void) populateFromDictionary:(NSDictionary*)dict; | |
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict | |
inContext:(NSManagedObjectContext*)context; | |
@end |
Typical Bit Mask Operations | |
Set a flag or overlay multiple values | |
flags | flagbitN | |
Unset a flag (zero-out a bit or set a bit to zero) | |
flags & ~flagbitN | |
Check if a bit is set | |
(flags & flagbitN) == flagbitN |
Following is code for find all fonts from the system: | |
for(NSString *fontfamilyname in [UIFont familyNames]) | |
{ | |
NSLog(@"Family:'%@'",fontfamilyname); | |
for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname]) | |
{ | |
NSLog(@"\tfont:'%@'",fontName); | |
} | |
NSLog(@"~~~~~~~~"); |
After some digging through the storyboard source code, it turns out that the iPad storyboard was copied from the iPhone storyboard. So, the question really became how do I convert an iPhone storyboard into an iPad storyboard? | |
The answer is surprisingly simple. I ran across this SO answer -- to convert an iPhone storyboard to an iPad storyboard, do the following: | |
From Xcode, right-click on the storyboard and choose Open As -> Source code | |
Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad" | |
Right-click on the storyboard again and choose Open As -> iOS Storyboard | |
The storyboard will now show all views in the correct size. |
let API_HEADER_FIELD_NONE_MATCH : String = "If-None-Match" | |
let API_HEADER_FIELD_ETAG : String = "Etag" | |
let API_REQUEST_SUCCESS : Int = 200 | |
func ETagForURL(urlString: String) -> String? { | |
// return the saved ETag value for the given URL | |
return NSUserDefaults.standardUserDefaults().objectForKey(urlString) as String? | |
} | |
//Read String array separated by new line character | |
func readInput () -> [String]{ | |
let n: Int = Int(readLine()!)! | |
var strs = [String]() | |
(0...n-1).map { _ in | |
strs.append(readLine()!.lowercased()) | |
} | |
return strs | |
} |