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
DROP TABLE IF EXISTS `carts`; | |
CREATE TABLE `carts` ( | |
`user_id` int NOT NULL, | |
`food_id` int NOT NULL, | |
`quantity` int NOT NULL, | |
`status` int NOT NULL DEFAULT '1', | |
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, | |
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
PRIMARY KEY (`user_id`,`food_id`), |
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
- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event { | |
if (layer == self.shapeLayer && [event isEqualToString:@"strokeEnd"]) { | |
//Only perform animation action when in a UIView animation block | |
CAAnimation *opacityAction = (id)[super actionForLayer:layer forKey:@"opacity"]; | |
if (opacityAction && ![opacityAction isKindOfClass:[NSNull class]] && [opacityAction isKindOfClass:[CAAnimation class]]) { | |
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:event]; | |
animation.fromValue = [layer.presentationLayer valueForKey:event]; | |
animation.duration = opacityAction.duration; | |
return animation; | |
} else { |
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
<x | |
xmlns="jabber:x:data" type="form"> | |
<title>Room configuration</title> | |
<instructions>The room "5ae8806bcf3508a9e0ed6ecedd160627" has been created. To accept the default configuration, click the "OK" button. Or, modify the settings by completing the following form:</instructions> | |
<field var="FORM_TYPE" type="hidden"> | |
<value>http://jabber.org/protocol/muc#roomconfig</value> | |
</field> | |
<field var="muc#roomconfig_roomname" type="text-single" label="Room Name"> | |
<value>5ae8806bcf3508a9e0ed6ecedd160627</value> | |
</field> |
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
// Add background color to middle tabBarItem | |
let itemIndex = 2 | |
let bgColor = UIColor(red: 0.08, green: 0.726, blue: 0.702, alpha: 1.0) | |
let itemWidth = tabBar.frame.width / CGFloat(tabBar.items!.count) | |
let bgView = UIView(frame: CGRectMake(itemWidth * itemIndex, 0, itemWidth, tabBar.frame.height)) | |
bgView.backgroundColor = bgColor | |
tabBar.insertSubview(bgView, atIndex: 0) |
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
NSInteger numberOfItems = self.tabBar.items.count; | |
CGSize tabBarItemSize = CGSizeMake(self.tabBar.frame.size.width / numberOfItems, self.tabBar.frame.size.height); | |
self.tabBar.selectionIndicatorImage = [UIImage imageWithColor:[UIColor colorWithHexString:@"#040A0F" ] size:tabBarItemSize]; | |
NSInteger itemIndex = 2; | |
CGFloat itemWidth = self.tabBar.frame.size.width / numberOfItems; | |
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
// | |
// CommonAutolayoutUtils.h | |
// Vien Vu | |
// | |
// Created by Vien Vu on 1/8/16. | |
// Copyright © 2016 Vien Vu. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
//Add constraint with top left right bottom is (0, 0, 0, 0) | |
func addChildToContainer(parent container: UIView, child childView: UIView) { | |
container.addSubview(childView) | |
childView.translatesAutoresizingMaskIntoConstraints = false | |
let views = Dictionary(dictionaryLiteral: ("childView", childView),("container", container)) | |
//Horizontal constraints | |
let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|[childView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views) | |
container.addConstraints(horizontalConstraints) | |