Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

fengxing annidy

💭
I may be slow to respond.
Block or report user

Report or block annidy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@annidy
annidy / textHeight.m
Created May 22, 2019 — forked from brennanMKE/textHeight.m
Text Height in Objective-C for NSString and NSAttributedString
View textHeight.m
- (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth {
if ([text isKindOfClass:[NSString class]] && !text.length) {
// no text means no height
return 0;
}
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;
CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size;
View Python3 HTTP Server.py
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
@annidy
annidy / svnappstore.sh
Last active Sep 14, 2018
fast svn checkout
View svnappstore.sh
SvnSource=$1
TargetDir=$2
svn co --depth immediates $SvnSource $TargetDir
svn up --depth immediates $TargetDir/module
svn up --set-depth infinity $TargetDir/module/cpp
svn up --set-depth infinity $TargetDir/module/ios
svn up --depth immediates $TargetDir/project/ios
@annidy
annidy / fps.c
Created Mar 16, 2018
快速计算fps
View fps.c
static int counter;
static long counter_ms;
struct timeval time;
long now;
if (counter == 0) {
counter = 1;
gettimeofday(&time, NULL);
counter_ms = (time.tv_sec * 1000) + (time.tv_usec / 1000);
} else if (counter > 100) {
gettimeofday(&time, NULL);
View build.sh
#!/bin/sh
set -x
rm -rf libs
ABIS=(armeabi armeabi-v7a arm64-v8a)
# @see https://fucknmb.com/2017/06/27/cmake-%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91/
@annidy
annidy / build.sh
Last active Mar 6, 2018
general build
View build.sh
#通用iOS工程静态库编译脚本
BUILD_PROJ=$1
BUILD_TARGET=$2
BUILD_OUTPUT=$3
BUILD_CONFIGURATION=$4
BUILD_BIN=xcodebuild
#获取SDK编译版本
BUILD_SDK_VERSION=$(${BUILD_BIN} -showsdks | grep iphoneos | sort -r | head -n 1 | grep -o '.\{4\}$')
if [[ ${BUILD_SDK_VERSION} = "" ]]; then
echo "Error: No iPhone SDK ..."
@annidy
annidy / patch.diff
Created Aug 15, 2017
patch for FFmpeg cache on iOS
View patch.diff
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 34070d933b..f96bdf11ac 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -28,6 +28,9 @@
#if HAVE_IO_H
#include <io.h>
#endif
+#if defined(__APPLE__)
+#include <CoreFoundation/CoreFoundation.h>
@annidy
annidy / AVAsset+VideoOrientation.h
Created Apr 25, 2017 — forked from lukabernardi/AVAsset+VideoOrientation.h
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
View AVAsset+VideoOrientation.h
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait
@annidy
annidy / ctags.setup
Last active Mar 13, 2017 — forked from nazgob/ctags.setup
ctags setup on mac
View ctags.setup
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log -f .tags *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@annidy
annidy / alias.sh
Created Mar 7, 2017
echo unicode paste board
View alias.sh
alias pbecho='echo -e "`pbpaste`"'
You can’t perform that action at this time.