Skip to content

Instantly share code, notes, and snippets.

View bahaddinyasar's full-sized avatar

Bahaddin Yaşar bahaddinyasar

  • San Francisco
View GitHub Profile
@bahaddinyasar
bahaddinyasar / deferred_callbacks_with_jquery__real_world_example.js
Created August 27, 2012 11:00
Deferred Callbacks w/ jQuery - Real World Example
function saveContact( row ){
var form = $.tmpl(templates["contact-form"]),
valid = true,
messages = [],
dfd = $.Deferred();
/*
bunch of client-side validation here
*/
@bahaddinyasar
bahaddinyasar / useful_jquery_ui_plugins.txt
Created August 27, 2012 11:44
Useful jQuery UI Plugins
jQuery UI MultiSelect Widget:
http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/
@bahaddinyasar
bahaddinyasar / ios_debugger_tips_and_tricks.txt
Created August 28, 2012 08:38
IOS Debugger(lldb): Tips and Tricks
The po command stands for "print object."
The symbol $eax refers to one of the CPU registers. In the case of an exception, this register will contain a pointer to the NSException object.
Note: $eax only works for the simulator, if you’re debugging on the device you’ll need to use register $r0.
(lldb) po [$eax class]
You will see something like this:
(id) $2 = 0x01446e84 NSException
You can call any method from NSException on this object. For example:
@bahaddinyasar
bahaddinyasar / iOS_Check_Network_Connection_and_show_UIAlertView_if_necessary.txt
Created September 8, 2012 14:41
iOS Check Network Connection and show UIAlertView if necessary
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
if(internetStatus == NotReachable) {
UIAlertView *errorView;
errorView = [[UIAlertView alloc]
initWithTitle: NSLocalizedString(@"Network error", @"Network error")
message: NSLocalizedString(@"No internet connection found, this application requires an internet connection to gather the data required.", @"Network error")
delegate: self
@bahaddinyasar
bahaddinyasar / iOS_NSURLConnectionClient_Disable_Caching.txt
Created September 9, 2012 13:19
iOS NSURLConnectionClient Disable Caching
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
sharedCache = nil;
Reference: http://www.iphonedevsdk.com/forum/iphone-sdk-development/52972-cfdata-memory-problem.html
@bahaddinyasar
bahaddinyasar / linear_gradient_button.css
Created September 19, 2012 11:04
Linear Gradient Button CSS Class
input.greenButton{
float: right;
color: #FFFFFF;
display: block;
font-size: 14px;
font-weight: normal;
line-height: 20px;
margin: 10px 20px 0 0;
padding: 5px 8px;
text-decoration: none;
@bahaddinyasar
bahaddinyasar / twitter_like_inputtext_css_class.css
Created September 24, 2012 10:38
Twitter like Input Text Css Class
.inputtext {
background-color: #FFFFEC;
border: 1px solid #ECECFF;
border-radius: 5px 5px 5px 5px;
box-shadow: -1px 0 8px -5px #000000;
font-size: 14px;
}
.inputtext:hover, .inputtext:focus {
background-color: #FFFFFF;
border: 1px solid #56B4EF;
@bahaddinyasar
bahaddinyasar / angularjs_and_jqueryui_slider_binding.html
Created September 24, 2012 13:46
AngularJS and jQueryUI slider binding
<html ng-app="myApp">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script type="text/javascript" ng:autobind src="http://code.angularjs.org/1.0.2/angular.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript">
function MyController() {
this.years = "1950";
@bahaddinyasar
bahaddinyasar / checking_for_icloud_availability.m
Created October 5, 2012 07:10
Checking for iCloud Availability
// in the AppDelegate.m, add the following code to the method application:didFinishLaunchingWithOptions
NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
if (ubiq) {
NSLog(@"iCloud access at %@", ubiq);
// TODO: Load document...
} else {
NSLog(@"No iCloud access");
}
@bahaddinyasar
bahaddinyasar / how_to_put_a_checkbox_in_a_uitableviewcell.m
Created October 5, 2012 08:55
How to put a checkbox in a UITableViewCell
- (void)tableView:(UITableView *)theTableView
didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath {
[theTableView deselectRowAtIndexPath:[theTableView indexPathForSelectedRow] animated:NO];
UITableViewCell *cell = [theTableView cellForRowAtIndexPath:newIndexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
// Reflect selection in data model
} else if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;