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
//http://superuser.com/questions/203707/how-to-uninstall-homebrew-osx-package-manager | |
Here's how they recommend doing it: | |
cd `brew --prefix` | |
rm -rf Cellar | |
brew prune | |
rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew | |
rm -rf ~/Library/Caches/Homebrew | |
This should also revert your /usr/local folder to its pre-Homebrew days. See the Homebrew installation wiki for more information. |
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
// From: http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview | |
NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; | |
[webView stringByEvaluatingJavaScriptFromString:@"var script = document.createElement('script');" | |
"script.type = 'text/javascript';" | |
"script.text = \"function myFunction() { " | |
"var field = document.getElementById('field_3');" | |
"field.value='Calling function - OK';" | |
"}\";" | |
"document.getElementsByTagName('head')[0].appendChild(script);"]; |
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
//----- LIST ALL FILES ----- | |
NSLog(@"LISTING ALL FILES FOUND"); | |
int Count; | |
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectoryName"]; | |
NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL]; | |
for (Count = 0; Count < (int)[directoryContent count]; Count++) | |
{ |
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
[[NSFileManager defaultManager] moveItemAtPath:MySourcePath toPath:MyDestPath error:nil]; |
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
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"My Directory"]; | |
path = [path stringByAppendingPathComponent:@"My Filename"]; | |
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) | |
{ | |
//File exists | |
NSData *file1 = [[NSData alloc] initWithContentsOfFile:path]; | |
if (file1) |
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
NSData *file; | |
file = ... | |
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectoryName"]; | |
path = [path stringByAppendingPathComponent:@"SomeFileName"]; | |
[[NSFileManager defaultManager] createFileAtPath:path | |
contents:FileData | |
attributes:nil]; |
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
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectoryName"]; | |
NSError *error; | |
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) //Does directory already exist? | |
{ | |
if (![[NSFileManager defaultManager] createDirectoryAtPath:path | |
withIntermediateDirectories:NO | |
attributes:nil | |
error:&error]) |
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
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectoryName"]; | |
NSError *error; | |
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) //Does directory exist? | |
{ | |
if (![[NSFileManager defaultManager] removeItemAtPath:path error:&error]) //Delete it | |
{ | |
NSLog(@"Delete directory error: %@", error); |
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
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectory"]; | |
path = [path stringByAppendingPathComponent:@"SomeFileName"]; | |
NSError *error; | |
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) //Does file exist? | |
{ | |
if (![[NSFileManager defaultManager] removeItemAtPath:path error:&error]) //Delete it | |
{ | |
NSLog(@"Delete file error: %@", error); |
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
NSString *path; | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SomeDirectory"]; | |
path = [path stringByAppendingPathComponent:@"SomeFileName"]; | |
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) | |
{ |
NewerOlder