Skip to content

Instantly share code, notes, and snippets.

View akring's full-sized avatar

Chris Akring akring

View GitHub Profile
@akring
akring / _0__ssl_certbot_letsencrypt.md
Created January 28, 2022 03:35 — forked from maxivak/_0__ssl_certbot_letsencrypt.md
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@akring
akring / gist:1b3f9dd37fb9a0f9f90ffddc0c892eb6
Created June 6, 2017 06:07
ObjectMapper 数据转换范例(Int <==> String)
let intTransform = TransformOf<String, Int>(fromJSON: { (value: Int?) -> String? in
// transform value from String? to Int?
if let value = value {
return String(value)
}
return nil
}, toJSON: { (value: String?) -> Int? in
// transform value from Int? to String?
return Int(value!)
})
@akring
akring / 0_reuse_code.js
Created October 28, 2015 07:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@akring
akring / gist:4d89430042304224e438
Created December 30, 2014 05:19
判断用户的照片/相机权限是否开启
//导入头文件
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>
//判断代码
- (BOOL)isCameraAndAssetsAvilable{
AVAuthorizationStatus cameraAuthor = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];//判断相机权限
ALAuthorizationStatus assetsAuthor = [ALAssetsLibrary authorizationStatus];//判断照片权限