Skip to content

Instantly share code, notes, and snippets.

View levey's full-sized avatar

Jiangang Zhu levey

  • Bindo Labs
  • Shanghai, China
View GitHub Profile
@anvaka
anvaka / 00.Intro.md
Last active May 25, 2024 16:09
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@quellish
quellish / xcci.md
Created October 28, 2014 03:03
Xcode CI script variables

Variable

Type

@gustafnilklint
gustafnilklint / NSDictionary+prettyPrint.m
Created September 15, 2014 21:23
NSDictionary print itself as litheral
//
// NSDictionary+prettyPrint.m
// GarageRemote
//
// Created by Gustaf Nilklint on 2014-09-15.
// Copyright (c) 2014 Gustaf Nilklint. All rights reserved.
//
#import "NSDictionary+prettyPrint.h"
@jpsim
jpsim / LevelDB.m
Last active August 29, 2015 14:04
RealmStringsBenchmarks
#import <Objective-LevelDB/LevelDB.h>
#include <mach/mach_time.h>
#include <stdint.h>
NSString *randomString(NSUInteger length) {
NSMutableString *string = [NSMutableString stringWithCapacity:length];
for (int i = 0; i < length; i++) {
[string appendFormat:@"%C", (unichar)('a' + arc4random_uniform(25))];
}
return string;
@furkanmustafa
furkanmustafa / NSBaseConversion.mm
Created May 28, 2013 02:00
Objective-C Base Conversion
/**
Original Code From, Md. Mahmud Ahsan, http://thinkdiff.net/mixed/base-conversion-handle-upto-36-bases/, 2008.02.28
Adapted Objective-C, Furkan Mustafa, 2013.05.28
Description: Alpha Numeric Base Conversion, Handles upto base 36
*/
NSString* reverseString(NSString* original) {
const char* chars = [original cStringUsingEncoding:NSASCIIStringEncoding];
int length = strlen(chars);
char* new = (char*)malloc(length+1);
anonymous
anonymous / gist:4294066
Created December 15, 2012 11:48
Make Xcode nag you about unfinished TODOs
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@Inferis
Inferis / UIView+RoundedOverlay.h
Created October 9, 2012 19:21
Apply a rounded overlay to a viewcontroller.
//
// UIView+RoundedOverlay.h
//
// Created by Tom Adriaenssen on 05/04/12.
//
#import <UIKit/UIKit.h>
@interface UIViewController (RoundedOverlay)
@dav
dav / gist:3738695
Created September 17, 2012 17:40
Script to copy photos/videos into iPhone Simulator
require 'etc'
require 'fileutils'
# Copies the most recent MAX_IMAGES photos/videos from the device image dir.
# I use Dropbox to sync my device images to my workstation disk
MAX_IMAGES=500
USER_HOME_DIR = Etc::getpwuid.dir
DEVICE_IMAGES_DIR="#{USER_HOME_DIR}/Dropbox/Camera Uploads"
SIMULATOR_IMAGES_DIR="#{USER_HOME_DIR}/Library/Application Support/iPhone Simulator/5.1/Media/DCIM/100APPLE"
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@interface UIImage (fixOrientation)
- (UIImage *)fixOrientation;
@end