Snippets of the day – Wednesday, February 26, 2014

Posted on Posted in Snippets

software-development

Here are some of the most recently published snippets!

How to checkout the latest tag of a Git repository

This simple bash script allows to automatically checkout your local git repository on the latest tagged version available on the remote repository.

The script assumes to be run from your local repo.
The command ‘git rev-list –tags’ lists the tags IDs in reverse chronological order, getting the very last one on top.
The command ‘git describe –tags’ returns the tag name, associated to such ID, you can use to checkout from.

Original source: http://julienrenaux.fr/2013/10/04/how-to-automatically-checkout-the-latest-tag-of-a-git-repository/

Open the snippet

Author:    lbottaro

C#: Parse a comma separated string into a collection of numeric items

This method can be used with any separator you need, just setting the ‘separator’ input

Open the snippet

Author:    cghersi

C#: How to dinamically check a string and its length using a Regex

Thsi method creates a Regex by replacing a placeholder as minimum and maximum length (e.g. in case of username and / or password verifiers…).
It can be extended also to apply different Regex with respect to some particular business logic.

Open the snippet

Author:    cghersi

Leave a Reply

Your email address will not be published. Required fields are marked *