Skip to content

Instantly share code, notes, and snippets.

View naokits's full-sized avatar

nao naokits

  • Individual Application Developer
View GitHub Profile
@naokits
naokits / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@naokits
naokits / iOSDocumentMigrator.m
Created December 14, 2011 03:37 — forked from steipete/iOSDocumentMigrator.m
Helps migrating documents between iOS <= 5.0 and >= 5.0.1 to comply with Apple's iCloud guidelines. Follow @steipete on Twitter for updates.
#include <sys/xattr.h>
/// Set a flag that the files shouldn't be backuped to iCloud.
+ (void)addSkipBackupAttributeToFile:(NSString *)filePath {
u_int8_t b = 1;
setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}
/// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available.
+ (NSString *)legacyStoragePath {
require 'rbconfig'
ruby_path = File.join(Config::CONFIG["bindir"],
Config::CONFIG["RUBY_INSTALL_NAME"]+
Config::CONFIG["EXEEXT"])