Skip to content

Instantly share code, notes, and snippets.

Win+Home: Clear all but the active window.P
Win+Space: All windows become transparent so you can see through to the desktop.P
Win+Up arrow: Maximize the active window.P
Shift+Win+Up arrow: Maximize the active window vertically.P
Win+Down arrow: Minimize the window/Restore the window if it's maximized.P
Win+Left/Right arrows: Dock the window to each side of the monitor.P
Shift+Win+Left/Right arrows: Move the window to the monitor on the left or right.P
You can also interact with windows by dragging them with the mouse:P
Drag window to the top: MaximizeP
Trace.Listeners.Add(new TextWriterTraceListener(@"c:\tmp\tracelog.txt"));
Trace.AutoFlush = true;
Trace.Indent();
Trace.WriteLine("Entering Main");
Console.WriteLine("Hello world");
Trace.Unindent();
@bsdshell
bsdshell / *.m
Last active August 29, 2015 14:26
UIImagePickerController simple example, Override camera button, OverlayView example
@interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate>{
NSMutableArray* _capturedImages;
}
@property(nonatomic, retain)NSMutableArray* capturedImages;
@end
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
@bsdshell
bsdshell / *.m
Last active August 29, 2015 14:26
UIAlertController alert message
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert"
message:@"This is an alert."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
NSLog(@"this is my action");
}];
[alert addAction:defaultAction];
@bsdshell
bsdshell / 0_reuse_code.js
Last active August 29, 2015 14:26
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
@bsdshell
bsdshell / *.m
Last active August 29, 2015 14:26
get document directory, nsdocumentdirectory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"logfile.txt"];
@bsdshell
bsdshell / *.m
Last active August 29, 2015 14:26
write nsdata to file, write nsdata to document directory
NSData* responseData = [[NSData alloc]init];
// path to document directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"myfile.svg"];
// write responseData to myfile.svg
@bsdshell
bsdshell / *.m
Created August 1, 2015 21:30
directory in ios document directory etc
NSApplicationDirectory = 1, // supported applications (Applications)
NSDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos)
NSDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory.
NSAdminApplicationDirectory, // system and network administration applications (Administration)
NSLibraryDirectory, // various documentation, support, and configuration files, resources (Library)
NSDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory.
NSUserDirectory, // user home directories (Users)
NSDocumentationDirectory, // documentation (Documentation)
NSDocumentDirectory, // documents (Documents)
@bsdshell
bsdshell / *.m
Created August 4, 2015 08:29
read file to NSData
NSString* fullPathFile = [self.appdelegate.encryptThumbPath stringByAppendingPathComponent:@"file.txt"];
NSData* nsData = [[NSFileManager defaultManager] contentsAtPath:fullPathFile];
NSMutableArray* groups;
ALAssetsLibraryGroupsEnumerationResultsBlock listGroupBlock = ^(ALAssetsGroup *group, BOOL* stop){
if(group){
[groups addObject:group];
}else{
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
}
};