Skip to content

Instantly share code, notes, and snippets.

View marshluca's full-sized avatar
🏠
Working from home

Lucas Zhang marshluca

🏠
Working from home
View GitHub Profile
class Polygon
@@sides = 10
def self.sides
@@sides
end
end
puts Polygon.sides # => 10
class Triangle < Polygon
# put this in your lib folder as logger_format.rb and
# require it in your environment or an initializer
class Logger
def format_message(level, time, progname, msg)
"#{time.to_s(:long)} -- #{msg}\n"
end
end
require 'rubygems'
require 'httparty'
APP_KEY = "48578869"
class Sina
include HTTParty
base_uri "api.t.sina.com.cn"
default_params :source => APP_KEY
#define activityViewTag 0x98751234
@interface UIView (UIViewUtils)
- (void)showActivityViewAtCenter;
- (void)hideActivityViewAtCenter;
- (UIActivityIndicatorView*)createActivityViewAtCenter:(UIActivityIndicatorViewStyle)style;
- (UIActivityIndicatorView*)getActivityViewAtCenter;
@end
require 'rubygems'
require 'net/http'
require 'digest/md5'
require 'json'
API_KEY = "679826437258ff2c66d19e28a96c55fa"
SECRET_KEY = "830f73caf91179b68106fa5bcf0de4ce"
SESSION_KEY = "23536043_100001974_23536043_1284951867_701ca12bcf155352212387aec74c99e6"
API_SERVER = "http://rest.kaixin001.com/api/rest.php"
vim /etc/apache2/httpd.conf
# restart
sudo apachectl restart
#pragma mark -
#pragma mark MKMapViewDelegate
- (void)showDetails:(id)sender
{
[self.navigationController setToolbarHidden:YES animated:NO];
// navigation to detail view
}
- (UIImage *)resizeImage:(UIImage *)flagImage
#import <Foundation/Foundation.h>
@interface MyButton : UIButton
{
NSDictionary *dict;
}
@property (nonatomic, retain) NSDictionary *dict;
@marshluca
marshluca / RoundRect_for_TextView.m
Created November 5, 2010 03:21
set Round Rect border for UITextView
#import <QuartzCore/QuartzCore.h>
[self.content.layer setBackgroundColor:[[UIColor whiteColor] CGColor]];
[self.content.layer setBorderColor:[[UIColor grayColor] CGColor]];
[self.content.layer setBorderWidth:1.0];
[self.content.layer setCornerRadius:8.0];
[self.content.layer setMasksToBounds:YES];
self.content.clipsToBounds = YES;
@marshluca
marshluca / removeCellAtIndexPath.m
Created November 15, 2010 03:05
removeCellAtIndexPath
- (NSIndexPath *)indexPath
{
NSUInteger row = [sender tag] - 300;
NSUInteger section = 0;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
return indexPath;
}
- (void)removeCellAtIndexPath:(NSIndexPath *)indexPath
{