This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :prize do | |
name "iPhone" | |
image { File.new(Rails.root.join("app/assets/images/sample/sample-prize-2.png")) } | |
icon { File.new(Rails.root.join("app/assets/images/sample/scratch-2.png")) } | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails g model Coupon name coupon_type discount:float description:text category_id:integer address:string terms_and_conditions:text | |
t.string :image_file_name | |
t.integer :image_file_size | |
t.string :image_content_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tootz git:(develop) rails c | |
[1] pry(main)> User.where("email like '%webztj%'") | |
[2] pry(main)> u = User.find 1 | |
[3] pry(main)> Ticket.create user_id: 1 | |
[4] pry(main)> Message.create user_id: 2, subject: 'hello wolrd', body: 'good day' | |
reload! | |
Ticket.all.each{|t| t.assign_images } | |
u = User.find 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSDictionary*) fetchMessageList:(NSInteger)pagenum { | |
NSString* urlstring = [NSString stringWithFormat:@"%@/api/v1/user/messages.json?page=%d", BaseURL, pagenum]; | |
NSLog(@"Message List URL : %@", urlstring); | |
NSURL* url = [NSURL URLWithString:urlstring]; | |
MBGetDataRequest* request = [MBGetDataRequest requestWithURL:url]; | |
[request applyHTTPHeaders:[NSDictionary dictionaryWithObjectsAndKeys: | |
[[MBPreferenceManager sharedPreferenceManager] getSecurityKey], | |
@"Http-X-User-Access-Token", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QSection *sec2 = [[[QSection alloc] initWithTitle:@""] autorelease]; | |
[root addSection:sec2]; | |
QButtonElement *buttonElement1 = [[QButtonElement alloc] initWithTitle:@"Done"]; | |
buttonElement1.key = @"Done"; | |
buttonElement1.onSelected = ^(void) { | |
NSMutableDictionary* d = [[NSMutableDictionary alloc] init]; | |
[root fetchValueIntoObject:d]; | |
QSelectSection* sec = (QSelectSection*)[self.root sectionWithKey:@"Addresses"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) textViewDidEndEditing:(UITextView *)textView | |
{ | |
CGRect frame = mTextView.frame; | |
frame.size.height = mTextView.contentSize.height; | |
mTextView.frame = frame; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. update: | |
api: | |
put :update do | |
authenticate! | |
if current_user.update_attributes params[:user] | |
current_user | |
else | |
error!({ error: current_user.errors.full_messages }, 422) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. get specify cell in UITableView: | |
UITableViewCell *cell = [self.messageTableView cellForRowAtIndexPath:indexPath]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray* ary = [dict objectForKey:@"stores"]; | |
NSArray* sortedArray = [[NSArray alloc] init]; | |
sortedArray = [ary sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { | |
NSString *first = [NSString stringWithFormat:@"%@", [obj1 objectForKey:@"distance"]]; | |
NSString *second = [NSString stringWithFormat:@"%@", [obj2 objectForKey:@"distance"]]; | |
NSString *comFirst = [first substringWithRange:NSMakeRange(first.length-2, 1)]; | |
NSString *comSecond = [second substringWithRange:NSMakeRange(second.length-2, 1)]; | |
NSString *firstfloat; | |
NSString *seconfloat; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One. coupon_id => coupon.business => business.stores | |
1.{ | |
get '/:id', rabl: 'coupon' do | |
authenticate! | |
@coupon = Coupon.find params[:id] | |
end | |
object @coupon | |
attributes :id, :name, :category, :business_name, :expired_at |
OlderNewer