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 / 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
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
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 / 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"
View NSData+OADataHelpers.m
#import "NSData+OADataHelpers.h"
@implementation NSData (OADataHelpers)
- (NSString*) UTF8String
// First we try strict decoding to avoid iconv overhead when not needed (majority of cases).
NSString* str = [[[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding] autorelease];
if (!str)
View com.xcode_ramdisk.agent.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View NSObject+Blocks.h
// NSObject+Blocks.h
// Filemator
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
@interface NSObject (Blocks)
View NSString_CoreAdditions.m
@implementation NSString (CoreAdditions)
URL encode
- (NSString *)encodeURIComponent_NON_ARC
static NSString * const kLegalCharactersToBeEscaped = @"!*'();:@&=+$,/?%#[]";
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
View projects
# Objective-C most watched repositories
* [three20](
* [AFNetworking](
View gist:6025986
# Very alpha still, but getting there...
# Yeah, I like it this way
require 'pp'
require 'set'
require 'zlib'
require 'base64'
require 'socket'
require 'openssl'
require 'stringio'
You can’t perform that action at this time.