Sunday, 16 November 2014

Excel / Google Spreadsheet utilities

Generate a list of sheet names in the workbook (google spreadsheets only)

- https://productforums.google.com/forum/#!topic/docs/-2mGCzmUIkY

function sheetnames() {
  var out = new Array()
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i=0 ; i<sheets.length ; i++) out.push( [ sheets[i].getName() ] )
  return out  
}


Retrieving a specific cell value from other sheets

https://productforums.google.com/forum/#!topic/docs/YwfiGQpg5LI

Sheet name with no space:
=Sheet1!A1

Sheet name with space
='Sheet Name'!A1


Use string value from a cell to access worksheet of same name

http://stackoverflow.com/questions/16899175/excel-use-string-value-from-a-cell-to-access-worksheet-of-same-name

e.g. cell A5 has the string value of the worksheet name
=INDIRECT("'"&A5&"'!G7")




Tuesday, 14 October 2014

Sublime - search and replace text

Suppose I have multiple files that I want to replace the URL with something like follow:

www.something.com to
www.qa.something.com.au

Here is what to do:

Find:
www.([a-z]+).com

Replace:
www.qa.$1.com.au

Thursday, 2 October 2014

JSP/JSTL EL lastIndexOf

References
http://www.willuhn.de/blog/index.php?/archives/425-lastIndexOf-in-JSTL.html
http://www.tutorialspoint.com/jsp/jstl_function_substring.htm

Example:
<c:set var="text" value="This is a bunch of text" />
<c:set var="splittext" value="${fn:split(text,' ')}" />
${fn:indexOf(text, splittext[fn:length(splittext)-1])}

Git delete branch

Delete local branch

git branch -d [branchname]


Delete remote branch

git push origin --delete [branchname]
or
git push origin :[branchname]

The second way is basically saying "push nothing to remote [branchname]"

Git pushing local branch to specific remote branch

git push origin local_branch:remote_branch