This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
""" | |
This script fetches the two most recent, distinct semantic version tags from a Git repository | |
and generates a comparison URL between them, suitable for GitHub repositories. | |
This can help developers to quickly check their changes before releasing a Prod version. | |
Output of the script: | |
Comparison URL: https://github.com/[your-github-name]/[your-repo]/compare/4.4.2-rc1...4.4.3-rc2 | |
""" |
import Foundation | |
import UIKit | |
// Implements UITextFieldDelegate to support input features like showing thousand separator | |
// Useful for financial App currency number input, tested for multiple localizations, copy and paste numbers into the field. | |
// Usage: | |
// | |
// 1. Setup | |
// let textField = UITextField() | |
// let coordinator = DecimalTextFieldCoordinator(balanceTextField) |
// Why do you want a numeric version? Because number format is easier to use than string. | |
// For example, you may want to write a NSPredicate for Core Data fetch for different version: | |
// NSPredicate(format: "clientVersionNumber < %@", "2070500") // 2.7.5 | |
// This gist assume the version digit is limitted to 4. | |
public static var versionString: String { | |
return (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "1.0" | |
} | |
// Only support 4 digits, invalid string will return 0, longer digits will be dropped |
import Foundation | |
import UIKit | |
// A small utility for NSLayoutDimension shortcuts | |
public protocol PinObject { | |
var topAnchor: NSLayoutYAxisAnchor { get } | |
var bottomAnchor: NSLayoutYAxisAnchor { get } | |
var leadingAnchor: NSLayoutXAxisAnchor { get } | |
var trailingAnchor: NSLayoutXAxisAnchor { get } |
#!/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 |
#!/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. |
// | |
// 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" |
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]; | |
// 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');¬ | |
} |