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
#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
//
// Created by Chenyu Lan on 8/27/14.
// Copyright (c) 2014 Fenbi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "YTKNetworkConfig.h"
#import "YTKBaseRequest.h"
// 给url追加arguments,用于全局参数,比如AppVersion, ApiVersion等
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- array of downloads. -->
<key>items</key>
<array>
<dict>
<!-- an array of assets to download -->
@maojj
maojj / multiDeleteAmazonPersonalDocuments.js
Created November 5, 2014 03:41
Delete multi personal documents on Amazon for Kindle
// This is used to delete mulity personal documents for Amazon kindle.
//
// Thanks for xcv58 (http://www.amazon.com/gp/pdp/profile/A22UYYGCF3VPLE)
// http://www.amazon.com/forum/kindle/ref=cm_cd_pg_oldest?_encoding=UTF8&authToken=&cdForum=Fx1D7SY3BVSESG&cdPage=1&cdSort=newest&cdThread=Tx1NTIGX6GSG007
//
// 1.Make a bookmarklet, fill the url filed with the bottom javescript code.
// 2.In personal documents page, click the bookmarklet, and there will be a checkbox in front of every item.
// 3.Select the box if you want delete the item, and there are three links can select ALL, NONE and REVERSE.
// 4.Click the bookmarklet again, the selected items will be deleted perfectly!
//
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
@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];
@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>
#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 / 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
#
@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