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 / NSCalendar.m
Created Aug 15, 2013
NSCalendar示例
View NSCalendar.m
NSDate *date = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *comps;
// 年月日获得
comps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)
fromDate:date];
NSInteger year = [comps year];
NSInteger month = [comps month];
NSInteger day = [comps day];
@annidy
annidy / map.lua
Last active May 4, 2018
Xcode link map文件的lua分析脚本
View map.lua
#!/usr/bin/env lua
-- http://www.jianshu.com/p/92a041b1b825
obj_tbl = {} -- {[3]={file, module}}
syb_tbl = {} -- {[3]=47}
filter_tbl = nil -- {'Test.o'}
appname = nil
function process_object(line)
@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 / h264_sps_parser.h
Last active Sep 6, 2017
my sps parser ext
View h264_sps_parser.h
/*
* h264_sps_parser.h
*
* Copyright (c) 2014 Zhou Quan <zhouqicy@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@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>
You can’t perform that action at this time.