How to Automatically Update Xcode Build Numbers from Git

Quick Tip: How to Automatically Update Xcode Build Numbers from Git

Perfect! Now let’s make a build script to automatically update the build number in our Info.plist file whenever compiling a release build. Click on your Project name in the Navigator, and then click on your main build target under Targets. Click on the Build Phases tab. Go to Editor > Add Build Phase > Add Run Script Build Phase. Copy and paste the following code over the text that says ‘Type a script or drag a script file from your workspace to insert its path.’

#Update build number with number of git commits if in release mode
if [ ${CONFIGURATION} == "Release" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"

Note: Remember to only generate release builds when working in your release branch in git, typically master. Otherwise you will be using commit counts from another branch. (You really shouldn’t be making release builds from non-release branches anyway!)

Node.JS zlib demo

var zlib = require('zlib');

var input = 'aaa';

zlib.deflate(input, function(err, buffer) {
  if (!err) {

var zipped = 'eJwzMDBILE5JLDSgMQ0A2iIh0w==';

var buffer = new Buffer(zipped, 'base64');
zlib.unzip(buffer, function(err, buffer) {
  if (!err) {

/* inflate zipped string form C# */

var originStr = '123456';
var originBuffer = new Buffer(originStr,'utf8');

zlib.deflate(originBuffer, function(err, buffer) {
  if (!err) {

zlib.deflateRaw(originBuffer, function(err, buffer) {
  if (!err) {

zlib.gzip(originBuffer, function(err, buffer) {
  if (!err) {

var deflatedStr = 'MzQyNjE1AwA=';

var buffer = new Buffer(deflatedStr, 'base64');
zlib.inflate(buffer, function(err, buffer) {
  if (!err) {
  	console.log('\ninflate error:\n'+err);


var buffer = new Buffer(deflatedStr, 'base64');
zlib.inflateRaw(buffer, function(err, buffer) {
  if (!err) {
  	console.log('\ninflateRaw error:\n'+err);


var buffer = new Buffer(deflatedStr, 'base64');
zlib.gunzip(buffer, function(err, buffer) {
  if (!err) {
  	console.log('\ngunzip error:\n'+err);

var zippedStr = 'EQEAAB+LCAAAAAAABABljstqwzAQRf9FayuM3pF2wVBi+qR2Ng1dTCyJmDpukJVCKP33yl2UQpfnzpmZu/8kzfzY1cRFHOdQFerq+z+02d60v9jiGJ5xeiNOSKhIdxySf8KUr40PUx7ylTjCAdYAklTkAU+hBJsD9vgxpJLUlzFfUmim+F4GYaK7tqS3YdmLPRgrRKR9PEQqrY7UBlTUG8k0k9oD75cTKWAOvs14Ov98Y4KCokx3YB03juvVWpmXYt7hnHdn/982lKsOmBPcSbWyi1uEXLrC1+s3zaKDYBEBAAA=';

var buffer = new Buffer(zippedStr, 'base64');

buf2 = new Buffer(buffer.length - 4);

buffer.copy(buf2, 0, 4, buffer.length);

zlib.gunzip(buf2, function(err, buffer) {
  if (!err) {


Vim Syntax Highlight

Lexical highlighting might be a better name, but since everybody calls it syntax highlighting we’ll stick with that. Vim supports syntax highlighting on all terminals.

NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18*

A syntax group name is to be used for syntax items that match the same kind of
thing. These are then linked to a highlight group that specifies the color.
A syntax group name doesn’t specify any color or attributes itself.

The name for a highlight or syntax group must consist of ASCII letters, digits
and the underscore. As a regexp: “[a-zA-Z0-9_]*”

To be able to allow each user to pick his favorite set of colors, there must
be preferred names for highlight groups that are common for many languages.
These are the suggested group names (if syntax highlighting works properly
you can see the actual color, except for “Ignore”):

*Comment any comment

*Constant any constant
String a string constant: “this is a string”
Character a character constant: ‘c’, ‘\n’
Number a number constant: 234, 0xff
Boolean a boolean constant: TRUE, false
Float a floating point constant: 2.3e10

*Identifier any variable name
Function function name (also: methods for classes)

*Statement any statement
Conditional if, then, else, endif, switch, etc.
Repeat for, do, while, etc.
Label case, default, etc.
Operator “sizeof”, “+”, “*”, etc.
Keyword any other keyword
Exception try, catch, throw

*PreProc generic Preprocessor
Include preprocessor #include
Define preprocessor #define
Macro same as Define
PreCondit preprocessor #if, #else, #endif, etc.

*Type int, long, char, etc.
StorageClass static, register, volatile, etc.
Structure struct, union, enum, etc.
Typedef A typedef

*Special any special symbol
SpecialChar special character in a constant
Tag you can use CTRL-] on this
Delimiter character that needs attention
SpecialComment special things inside a comment
Debug debugging statements

*Underlined text that stands out, HTML links

*Ignore left blank, hidden |hl-Ignore|

*Error any erroneous construct

*Todo anything that needs extra attention; mostly the
keywords TODO FIXME and XXX

The names marked with * are the preferred groups; the others are minor groups.
For the preferred groups, the “syntax.vim” file contains default highlighting.
The minor groups are linked to the preferred groups, so they get the same
highlighting. You can override these defaults by using “:highlight” commands
after sourcing the “syntax.vim” file.

Note that highlight group names are not case sensitive. “String” and “string”
can be used for the same group.

The following names are reserved and cannot be used as a group name:
NONE ALL ALLBUT contains contained

When using the Ignore group, you may also consider using the conceal
mechanism. See |conceal|.

Continue reading Vim Syntax Highlight