Skip to content

Instantly share code, notes, and snippets.


Artem Loenko dive

View GitHub Profile
# Create a RAM disk with same perms as mountpoint
# Script based on with some additions
# Usage: sudo ./ start
View shouldStartLoadWithRequest_signature.m
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
dive / debug_embedded_uiwebview.m
Last active Aug 29, 2015
Debug embedded UIWebView
View debug_embedded_uiwebview.m
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
[NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
#pragma clang diagnostic pop
dive /
Last active Aug 29, 2015
Quick fix for Google Drive icon for dark menu bar (OS X 10.10)
# backup
find "$GOOGLE_DRIVE_DEFAULT_PATH"/ -type f -name 'mac-normal*.png' -exec cp -v '{}' '{}'.backup \;
# copy all needed files to tmp
cp -f -v "$GOOGLE_DRIVE_DEFAULT_PATH"/mac-normal*.png /tmp/
dive / gist:1952734
Created Mar 1, 2012
lepra stuff diff
View gist:1952734
--- 123.html
+++ (clipboard)
@@ -183,7 +183,7 @@
.main {
+ background:url(/i/login/field.jpg) 50% 64%;
dive / gist:1979003
Created Mar 5, 2012
coredata with dispatch
View gist:1979003
- (void)saveArrayOfImages:(NSMutableArray *)arrayOfImages
for (UIImage *imageObject in arrayOfImages)
dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(backgroundQueue, ^{
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSData *dataFromImage = UIImagePNGRepresentation(imageObject);
dive / gist:2920023
Created Jun 12, 2012
iOS 5 cyrillic domain byg
View gist:2920023
NSString *string = [NSString stringWithUTF8String: @"http://президент.рф"];
NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
After this operations I check NSURL with:
[[UIApplication sharedApplication] canOpenURL:url]
canOpenURL return true. Then I open this NSURL at build-in browser Safari,
Safari told me that this page cannot be opened
(encoded URL seems like: http://xn--d1abbgf6aiiy.xn--p1ai),
after this I just press Refresh at browser without any additional actions
dive / redefine_spotlight.scpt
Created Jun 16, 2012
Redefine Spotlight Privacy settings
View redefine_spotlight.scpt
set volume_path_to_disable to POSIX path of "/Volumes/Macintosh HD/"
set volume_path_to_enable to POSIX path of "/Volumes/OS X Mountain Lion"
set command to "mdutil -d " & quoted form of volume_path_to_disable & "&&" & "mdutil -i on " & quoted form of volume_path_to_enable
do shell script command with administrator privileges
dive / gist:2977600
Created Jun 23, 2012
instance variables (interface declaration)
View gist:2977600
/* 1 - непосредственно в интерфейсе класса (*.h) */
@interface IVExample : NSObject {
NSString *string;
int number;
dive / gist:2977631
Created Jun 23, 2012
instance variables (extension declaration)
View gist:2977631
/* 2 - в class extension */
@interface IVExample () {
NSString *string;
int number;