Skip to content

Instantly share code, notes, and snippets.

View mladjan's full-sized avatar

Mladjan Antic mladjan

View GitHub Profile
@mladjan
mladjan / 0_reuse_code.js
Created June 16, 2014 16:10
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
2010{
NSColor = "UIDeviceWhiteColorSpace 0 1";
NSFont = "<UICFFont: 0x9df0b90> font-family: \"Interstate-Light\"; font-weight: normal; font-style: normal; font-size: 8px";
NSKern = 0;
NSParagraphStyle = "Alignment 0, LineSpacing 10, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n 28L,\n 56L,\n 84L,\n 112L,\n 140L,\n 168L,\n 196L,\n 224L,\n 252L,\n 280L,\n 308L,\n 336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0, HeaderLevel 0";
NSStrokeColor = "UIDeviceWhiteColorSpace 0 1";
NSStrokeWidth = 0;
NSSuperScript = 1;
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"jquery" ofType:@"js"];
NSData *fileData = [NSData dataWithContentsOfFile:filePath];
NSString *jsString = [[NSMutableString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
[webView stringByEvaluatingJavaScriptFromString:jsString];
NSString *filePath2 = [[NSBundle mainBundle] pathForResource:@"spritely" ofType:@"js" inDirectory:nil];
NSData *fileData2 = [NSData dataWithContentsOfFile:filePath2];
NSString *jsString2 = [[NSMutableString alloc] initWithData:fileData2 encoding:NSUTF8StringEncoding];
Fetching: RedCloth-4.2.9.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/home/web/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/home/web/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: error while loading shared libraries: libruby.so.2.0: cannot open shared object file: No such file or directory
Gem files will remain installed in /home/web/.rvm/gems/ruby-2.0.0-p195/gems/RedCloth-4.2.9 for inspection.
ALLOCA:
AR: ar
ARCHFILE:
ARCH_FLAG:
AS: as
ASFLAGS:
BASERUBY: ruby
BUILTIN_TRANSSRCS: newline.c
CAPITARGET: nodoc
CC: gcc
/home/web/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb --with-cflags=-std=c99
/home/web/.rvm/rubies/ruby-1.9.3-p429/bin/ruby: error while loading shared libr$
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link href="./Ikonica_files/40153e562411c837feb701d492b095de858e76f5.png" rel="apple-touch-icon-precomposed" sizes="57x57" />
<link href="./Ikonica_files/40153e562411c837feb701d492b095de858e76f5.png" rel="apple-touch-icon-precomposed" sizes="114x114" />
<link href="./Ikonica_files/40153e562411c837feb701d492b095de858e76f5.png" rel="apple-touch-icon-precomposed" sizes="72x72" />
<link href="./Ikonica_files/40153e562411c837feb701d492b095de858e76f5.png" rel="apple-touch-icon-precomposed" sizes="144x144" />
-(IBAction)sendEmail{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
recipients = [[NSArray alloc] initWithObjects:@"labs@meilleurtaux.com", nil];
[controller setToRecipients:recipients];
[controller setSubject:@"Application meilleurtaux.com – Suggestion."];
[controller setMessageBody:@"" isHTML:NO];
[self presentModalViewController:controller animated:YES];
[[controller navigationBar] setTintColor:[UIColor colorWithRed:237.0f/255.0f green:152.0f/255.0f blue:51.0f/255.0f alpha:1.0f]];
UIImage *image = [UIImage imageNamed: @"MTheaderHeight42.png"];
@mladjan
mladjan / gist:1314617
Created October 25, 2011 22:56
Basic authentication
// U header fajlu definises delegate:
<RKRequestDelegate>
// u didFinishLaunching inicijalizujes singletone objekat RKClient i setujes domen za service:
RKClient *client = [RKClient clientWithBaseURL:@"http://taksiko.com"];
// u implementaciji ovako posaljes zahtev:
userParams = [NSDictionary dictionaryWithObjectsAndKeys:[defaults objectForKey:@"login"], @"table_number", [defaults objectForKey:@"password"], @"driver_password", nil];
[RKClient sharedClient].username = @"mladjan";
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://10.0.1.4:3000"];
RKObjectMapping* busesMapping = [RKObjectMapping mappingForClass:[Autobus class]];
[busesMapping mapKeyPath:@"model" toAttribute:@"model"];
[busesMapping mapKeyPath:@"tour_id" toAttribute:@"tourId"];
[busesMapping mapKeyPath:@"seat" toAttribute:@"seats"];
[busesMapping mapKeyPath:@"bus_number" toAttribute:@"busNumber"];
[busesMapping mapKeyPath:@"created_at" toAttribute:@"createdAt"];
[busesMapping mapKeyPath:@"updated_at" toAttribute:@"updatedAt"];