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
FROM node:8.12.0-alpine | |
# Installing AWS CLI | |
RUN apk add --no-cache --virtual .build-deps | |
RUN apk add bash | |
RUN apk add make && apk add curl && apk add openssh | |
RUN apk add git | |
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime | |
RUN apk -Uuv add groff less python py-pip | |
RUN pip install awscli |
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
version = '1.2' | |
// For publishing to AWS ECR | |
ext.dockerRegistryUrl = '_.dkr.ecr.ap-southeast-1.amazonaws.com/' | |
// Alternative Version to Publish | |
ext.dockerRegistryVersion = '1.0' | |
ext.dockerTag = dockerRegistryUrl + rootProject.name + '/' + project.name + ':' | |
task buildImage { | |
doLast { |
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
extension UILabel { | |
func textWidth() -> CGFloat { | |
return UILabel.textWidth(label: self) | |
} | |
class func textWidth(label: UILabel) -> CGFloat { | |
return textWidth(label: label, text: label.text!) | |
} | |
class func textWidth(label: UILabel, text: String) -> CGFloat { |
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
let inFormatter = DateFormatter() | |
inFormatter.dateFormat = "HH:mm" | |
let outFormatter = DateFormatter() | |
outFormatter.dateFormat = "HHmm" | |
"12:00".replacingOccurrences(of: ":", with: "") | |
let open = inFormatter.date(from: "12:00") | |
let open1 = outFormatter.string(from: open!) |
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
import Foundation | |
let d2r = Double.pi / 180.0 | |
let r2d = 180 / Double.pi | |
let earthRadius = 6371.0 | |
let lat = 1.350309 | |
let lng = 103.848237 | |
let radius = 1.0 // Km | |
let points = 10 // Points in polygon |
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
// How to log uncaught exception from Guice 9 | |
Thread.setDefaultUncaughtExceptionHandler((t, e) -> { | |
logger.error("Uncaught Exceptions: ", e.getCause()); | |
}); | |
Injector injector = Guice.createInjector(new MyModule()); |
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
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=512 | |
sudo /sbin/mkswap /var/swap.1 | |
sudo chmod 600 /var/swap.1 | |
sudo /sbin/swapon /var/swap.1 | |
sudo swapon -s |
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
#!/bin/bash | |
# Upgrade to Java-8 | |
sudo yum install java-1.8.0 | |
sudo yum remove java-1.7.0-openjdk | |
# Installing Artifactory | |
wget https://bintray.com/jfrog/artifactory-rpms/rpm -O bintray-jfrog-artifactory-rpms.repo | |
sudo mv bintray-jfrog-artifactory-rpms.repo /etc/yum.repos.d/ | |
sudo yum install jfrog-artifactory-oss |
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
/** | |
* Created By: Fuxing Loh | |
* Date: 28/10/2016 | |
* Time: 8:10 PM | |
* Project: munch-utils | |
*/ | |
public class ContentTypeError extends Exception { | |
/** | |
* Content-Type not found |
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
// Call this in layoutSubView or viewDidLoad | |
self.imageView.layer.sublayers?.forEach { $0.removeFromSuperlayer() } | |
let width = self.bounds.width | |
let height = self.bounds.height | |
let sHeight:CGFloat = 60.0 | |
let shadow = UIColor.black.withAlphaComponent(0.6).cgColor | |
// Add gradient bar for image on top | |
let topImageGradient = CAGradientLayer() |