Skip to content

Instantly share code, notes, and snippets.

View huangenyan's full-sized avatar

Evan E. Huang huangenyan

View GitHub Profile
import UIKit
extension UIImage {
func resizeImage(size: CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, true, 1)
self.draw(in: CGRect(origin: CGPoint.zero, size: size))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage

API URL: https://ra.apptech.com.hk/api/engine/companies/:company-id

Method: PATCH

parameters: company-id: The company ID specified in the email.

body

format: application/json
structure
{
  (optional)"news": [
    {
@huangenyan
huangenyan / takephoto.py
Created December 21, 2016 06:45
Take photo using OpenCV
import cv2
import sys
path = sys.argv[1]
if len(sys.argv) != 2:
print "Usage: %s <image_save_path>" % sys.argv[0]
cap = cv2.VideoCapture(0)
count = 0