The script below ensures that items are sorted by type first then by alphabetical order.
Sunday, April 17, 2016
The spaceship operator
Just ran into this and I thought it was really cool.
So the spaceship operator (<=>) delegates to the compareTo method:
For more checkout http://groovy-lang.org/operators.html
So the spaceship operator (<=>) delegates to the compareTo method:
assert (1 <=> 1) == 0
assert (1 <=> 2) == -1
assert (2 <=> 1) == 1
assert ('a' <=> 'z') == -1
For more checkout http://groovy-lang.org/operators.html
Thursday, March 3, 2016
Sending mail in unix
When sending an email from unix do the following
echo "Mail Message" | mail -s "Subject" person@home.com
In order to avoid getting your email marked as spam, ensure that the sending email is something realistic, probably a domain you own i.e. awesome@homelypeople.com
echo "Mail Message" | mail -s "Subject" person@home.com
In order to avoid getting your email marked as spam, ensure that the sending email is something realistic, probably a domain you own i.e. awesome@homelypeople.com
Reset local git branch to match remote
Setting your branch to exactly match the remote branch can be done in two steps:
git fetch origin
git reset --hard origin/master
git fetch origin
git reset --hard origin/master
Deleting git tags
Delete tag locally
git tag -d tagName
Delete tag on remote
git push --delete origin tagName
git tag -d tagName
Delete tag on remote
git push --delete origin tagName
Tuesday, February 16, 2016
jquery ajax timeout
When making an ajax request, it seems that jQuery only sets the timeout when the timeout property in the $.ajax call is defined.
You can see that from here https://github.com/jquery/jquery/blob/master/src/ajax.js#L684
Here is an excerpt from http://api.jquery.com/jquery.ajax/#timeout
You can see that from here https://github.com/jquery/jquery/blob/master/src/ajax.js#L684
Here is an excerpt from http://api.jquery.com/jquery.ajax/#timeout
Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
Monday, February 15, 2016
get autocomplete for git on mac os
Weird thing, I installed git for mac and i did not get autocomplete for git.
To fix this I followed this instructions http://www.codethatmatters.com/2010/01/git-autocomplete-in-mac-os-x/
To fix this I followed this instructions http://www.codethatmatters.com/2010/01/git-autocomplete-in-mac-os-x/
Subscribe to:
Posts (Atom)