Skip to content

Instantly share code, notes, and snippets.

View maojj's full-sized avatar
🎯
Focusing

JiaJun Mao maojj

🎯
Focusing
  • yuantiku.com
  • BeiJing
View GitHub Profile
# ~/.lldbinit
...
command script import /usr/local/bin/fblldb.py
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
/**
* Several macros simplifying use of weak references to self inside blocks
* which goal is to reduce risk of retain cycles.
*
* Example:
* @code
@interface Example : NSObject{
int _i;
}
@maojj
maojj / BuildDmg.sh
Last active February 19, 2022 23:03
#!/bin/sh
# BuildDmg.sh
# Build OS X .dmg install file
# Author maojiajun
set -eu
###################################################################################
# config, change for you app.
@maojj
maojj / BurnUSBInstall.sh
Last active August 29, 2015 14:03
A script for burning a Mac OS X bootable USB drive.
#!/bin/bash
#
# BurnUSBInstall.sh
#
# This is the script for burning a Mac OS X bootable USB drive.
#
# Author: maojj
# 2014.07.10
#
# Prepare an 8GB+ USB stick and format it with GUID partition mapping and a partition named Untitled
@maojj
maojj / autosync.sh
Last active August 29, 2015 14:04
An autosync script for bypy(Baidu Yun) on WD My Book Live
#!/bin/bash
#
# This is an autosync script for bypy(Baidu Yun) on WD My Book Live
# I use it in crontab(erery hour): 0 * * * * /path/to_this_script/autosync.sh
# a sync my cost more than an hour,
# so use flag file to make sure only one autosync.sh is running.(dirty way)
#
# About bypy: Python client for Baidu Yun (Personal Cloud Storage)
# see: https://github.com/houtianze/bypy
#
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
@interface CALayer(XibConfiguration)
// This assigns a CGColor to borderColor.
@property(nonatomic, assign) UIColor* borderUIColor;
@end
@maojj
maojj / UIView+Utils.h
Created August 10, 2014 15:27
UIView Utils Borrowed from Three20 / DTFoundation
//
// UIView+Utils.h
// Borrowed from Three20 / DTFoundation
//
// Copyright (c) 2013 iOS. No rights reserved.
//
#import <UIKit/UIKit.h>
@maojj
maojj / getFreeDiskspace.m
Created August 12, 2014 07:48
get Free Disk space on iphone, see: http://stackoverflow.com/a/8036586
-(uint64_t)getFreeDiskSpace {
uint64_t totalSpace = 0;
uint64_t totalFreeSpace = 0;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment