Skip to content

Instantly share code, notes, and snippets.

@candyan
candyan / gist:7427158
Created November 12, 2013 07:52
How to Deep Copy a UIView.
UIView *currentView = [[UIView alloc] initWithFrame:CGRectZero];
UIView *copyView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:currentView]];
{
"name": "AVOSCloud",
"version": "3.1.2.7",
"platforms": {
"ios": "5.1.1"
},
"summary": "LeanCloud iOS SDK for mobile backend.",
"homepage": "https://leancloud.cn",
"documentation_url": "https://leancloud.cn/docs/api/iOS/index.html",
"license": {
{
"name": "AVOSCloudIM",
"version": "3.1.2.7",
"platforms": {
"ios": "5.1.1"
},
"summary": "LeanCloud iOS Instant Message SDK for mobile backend.",
"homepage": "https://leancloud.cn",
"documentation_url": "https://leancloud.cn/docs/api/iOS/index.html",
"license": {
@candyan
candyan / gist:363ea4dbdcbceba28869
Last active January 21, 2016 09:22
iPhone & Android 通用的最佳全屏尺寸
1152 * 1920 (这个结论是通过统计和计算得出的)
@candyan
candyan / gist:054960b2100dd192b0b89e61031e4c46
Created September 5, 2016 12:21
Error: FBSDKInternalUtility viewControllerforView No know class method
tips: use viewControllerForView instead of viewControllerforView
@candyan
candyan / gist:a048abe577ec7c351a10351209b4f634
Last active October 10, 2016 14:00
zepto.js swipeUp & swipeDown not working on mobile device
add the listener to disable browser scroll.
```document.addEventListener('touchmove', function (event) {
event.preventDefault();
}, false);
```
ffmpeg -i $video_file -vn -ar 16000 -ac 1 -acodec pcm_s16le -ss 00:01:00 -t 00:00:30 $audio.wav
-vn 排除视频 (-an 排除音频 / -sn 排除字幕)
-ar 采样率
-ac 声道数量
-acodec 编码 ( flac / pcm_s16le(16bit 线性PCM) )
-ss 开始时间点
-t 时长
@candyan
candyan / spider.py
Created July 3, 2017 09:21
HD Course
# coding=utf8
import requests
class HDCourse:
def __init__(self, id, title, teacher_name, videos):
self.id = id
self.title = title
@candyan
candyan / latest-ffmpeg-centos6.sh
Last active September 1, 2017 12:28 — forked from mustafaturan/latest-ffmpeg-centos6.sh
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -L -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
#/bin/sh
yum install git -y
yum install vim -y
yum install wget -y
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
git clone https://github.com/candyan/shadowsocks-py-mu.git -b berrylab
pip install supervisor
mkdir -p /var/log/supervisor/