Skip to content

Instantly share code, notes, and snippets.

View apbarrero's full-sized avatar

Antonio Pérez Barrero apbarrero

View GitHub Profile
git config --global alias.ahead '!git log HEAD..origin/$(git symbolic-ref HEAD | sed "s:refs/heads/::g")'
@apbarrero
apbarrero / gist:2682f5d1db60ef204f49
Created June 22, 2014 07:24
git ahead (manual)
git log <current branch>..origin/<current branch>
@apbarrero
apbarrero / gist:1249333
Created September 28, 2011 21:41
While style looping
std::vector<CClass> MyVector;
std::vector<CClass>::const_iterator itElement = MyVector.begin();
while (itElement != MyVector.end()) {
const CClass& Object = (*itElement++);
// Do whatever you have to do with Object
}
@apbarrero
apbarrero / gist:1249340
Created September 28, 2011 21:44
For loop style
std::vector<CClass> MyVector;
for (std::vector<CClass>::const_iterator itElement = MyVector.begin(); itElement != MyVector.end(); ++itElement) {
// Do whatever you have to do with itElement
}
@apbarrero
apbarrero / gist:1262879
Created October 4, 2011 21:29
Result of first XSLT
<?xml version="1.0" encoding="utf-8"?>
<log>
<ticket>ISSUE-2</ticket>
<path kind="file" action="M">/trunk/file1.txt</path>
<path kind="file" action="M">/trunk/file2.txt</path>
<path kind="file" action="M">/trunk/file1.txt</path>
<path kind="file" action="M">/trunk/file4.txt</path>
</log>
<?xml version="1.0"?>
<log>
<logentry revision="1094175">
<author>apb</author>
<date>2011-04-17T17:11:32.825790Z</date>
<paths>
<path kind="file" action="M">/trunk/file1.txt</path>
<path kind="file" action="M">/trunk/file2.txt</path>
<path kind="file" action="M">/trunk/file3.txt</path>
</paths>
@apbarrero
apbarrero / gist:1262863
Created October 4, 2011 21:26
First XSLT for SVN log
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="ticket" select="__none__" />
<xsl:output encoding="utf-8" method="xml" indent="yes" />
<xsl:template match="log">
<xsl:copy>
<xsl:element name="ticket">
@apbarrero
apbarrero / gist:1268703
Created October 6, 2011 21:18
First XSLT using the Muenchian method for SVN log
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="ticket" select="__none__" />
<xsl:output encoding="utf-8" method="xml" indent="yes" />
<xsl:key use="text()" name="path-key"
match="path" />
<xsl:template match="log">
@apbarrero
apbarrero / gist:1268707
Created October 6, 2011 21:20
Result of first XSLT using the Muenchian method for SVN log
<?xml version="1.0" encoding="utf-8"?>
<log>
<ticket>ISSUE-2</ticket>
<path kind="file" action="M">/trunk/file4.txt</path>
</log>
@apbarrero
apbarrero / gist:1268715
Created October 6, 2011 21:22
Second XSLT using the Muenchian method (I)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="ticket" select="__none__" />
<xsl:output encoding="utf-8" method="xml" indent="yes" />
<xsl:template match="log">
<xsl:copy>
<xsl:element name="ticket">
<xsl:value-of select="$ticket" />