Skip to content

Instantly share code, notes, and snippets.

Working from home

Lex Tang lexrus

Working from home
Block or report user

Report or block lexrus

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
lexrus / vim.rb
Last active Dec 14, 2015 — forked from uasi/vim.rb
View vim.rb
require 'formula'
class Vim < Formula
homepage ''
url ''
head ''
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
View com.lextang.shadowsocks.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
lexrus / dnsmasq_autoddvpn.conf
Last active Dec 16, 2015
My DNSMasq Config For AutoDDVPN
View dnsmasq_autoddvpn.conf
lexrus / constellationByNSDate.c
Created Apr 27, 2013
constellationByNSDate the hard way
View constellationByNSDate.c
char *constellationByNSDate(NSDate *date) {
static char *constellations[13] = {"Capricorn","Aquarius","Pisces","Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn"};
static unsigned short constellationSeperates[12] = {20,19,21,21,21,22,23,23,23,24,22,22};
unsigned short dateStr[5];
NSLocale *CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_Hans_CN"];
[[date descriptionWithLocale:CNLocale] getCharacters:(unichar*)dateStr range:(NSRange){5, 5}];
unsigned short month = (dateStr[0] - '0') * 10 + (dateStr[1] - '0') - 1;
unsigned short day = (dateStr[3] - '0') * 10 + (dateStr[4] - '0');
return constellations[month + (day < constellationSeperates[month] ? 0 : 1)];
lexrus / TODO & FIXME for Xcode
Last active Dec 17, 2015
Treat // TODO: and // FIXME: as warnings in Xcode.
View TODO & FIXME for Xcode
find "${SRCROOT}" -type f \
\( \
-name "*.h" \
-or -name "*.m" \
-or -name "*.swift" \
\) \
-print0 \
| xargs -0 egrep --with-filename --line-number \
lexrus / gist:5574347
Created May 14, 2013
LTScrollView.m set contentSize that fit the contents of UIScrollView
View gist:5574347
#import "LTScrollView.h"
@implementation LTScrollView
- (void)layoutSubviews
CGFloat perfectContentWidth = 0.0f;
CGFloat perfectContentHeight = 0.0f;
BOOL isHorizontalScrollIndicatorVisible = self.showsHorizontalScrollIndicator;
lexrus / gist:5617493
Created May 21, 2013
Initial Phonetic Letter
View gist:5617493
static NSString *phonetic(NSString *sourceString) {
NSMutableString *source = [sourceString mutableCopy];
CFStringTransform((__bridge CFMutableStringRef) source, NULL, kCFStringTransformMandarinLatin, NO);
return source;
static inline NSString *initialPhoneticLetter(NSString *string) {
return [[[[phonetic([string substringToIndex:1]) substringToIndex:1] uppercaseString]
stringByReplacingOccurrencesOfString:@"\u0100" withString:@"A"]
stringByReplacingOccurrencesOfString:@"\u00c9" withString:@"E"];
lexrus / gist:5734257
Last active Jan 6, 2016
Log all NSNotifications. #import <objc/runtime.h> absolutely! Original:
View gist:5734257
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit"
// Log all notifications via tail -f /tmp/msgSends-*
#pragma clang diagnostic pop
lexrus / HD.txt
Last active Dec 9, 2019
All WWDC 2013 Session Videos URLs in dumped with Chrome. You can download these videos **without** a Apple developer account by running the script. There is also a sample code downloader here:
View HD.txt
lexrus / blocked
Last active Aug 30, 2017
My cow direct & blocked file for g*f*w
View blocked
You can’t perform that action at this time.