Skip to content

Instantly share code, notes, and snippets.

jakehao haojianzong

  • Shenzhen
View GitHub Profile
@haojianzong
haojianzong / file_sizes_group_by_type
Created Mar 31, 2016
Bash sum file sizes in folder group by file type
View file_sizes_group_by_type
#!/bin/bash
types=($(find . -type f -name '*.*' | sed 's|.*\.||' | sort -u))
IFS=$'\n';
for type in ${types[@]}; do
sum=$(find . -type f -name "*.$type" -exec du -ch {} + | grep total$)
echo "$type : $sum"
done
View svn-moves-with-synx.txt
#!/bin/sh
# This script move files from an old directory into a new dirctory
# using the file hierarchy from a reference directory, while preserving svn
# log history.
# The purpose is to organize files in one place and do 'svn mv' after
# you have finished organizing. In this way you don't need to worry about other
# developers commiting files while you are moving files around.
@haojianzong
haojianzong / GIF-Screencast-OSX.md
Last active Aug 29, 2015 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@haojianzong
haojianzong / gist:35619027a1e60754cf99
Created May 17, 2015
A Category to Set LocalizedString for Xib Files in User Define Runtime Attributes
View gist:35619027a1e60754cf99
//
// UIView+JZLocalizedIB.m
//
// Created by haojianzong on 12/5/17.
//
// A Category to Set LocalizedString for Xib Files in User Define Runtime Attributes
#import <UIKit/UIKit.h>
#import "JZLocaleUtils.h"
@haojianzong
haojianzong / JZBrief
Created Jan 19, 2015
NSString routine that generates a fix length brief
View JZBrief
static NSInteger mYStringlength = 60;
- (NSString *)brief:(NSString *)text
{
NSRange stringRange = {0, MIN([text length], mYStringlength)};
stringRange = [text rangeOfComposedCharacterSequencesForRange:stringRange];
NSString *shortBrief = [text substringWithRange:stringRange];
NSString *firstLine =[[self.text componentsSeparatedByString: @"\n"] objectAtIndex:0];
View gist:c7ab2b71a4f955b1bbdb
// this function will active menu using href match
// Author: http://www.paulund.co.uk/use-jquery-to-highlight-active-menu-item
function auto_active_menu() {¬
var url = window.location.href;¬
// Work for relative and absolute hrefs¬
$('.menu a').filter(function() {
return this.href == url;¬
}).addClass('active');¬
}
View StickyHeaderFlowLayout.h
//
// StickyHeaderFlowLayout.h
// Wombat
//
// Created by Todd Laney on 1/9/13.
// Copyright (c) 2013 ToddLa. All rights reserved.
//
// Modified from http://blog.radi.ws/post/32905838158/sticky-headers-for-uicollectionview-using THANKS!
//
You can’t perform that action at this time.