Skip to content

Instantly share code, notes, and snippets.

View loonix's full-sized avatar

Daniel Carneiro loonix

  • CADS UK
  • Vila Nova de Gaia, PT
View GitHub Profile
@loonix
loonix / Fetch-.CSV-Attachment-From-Gmail.gs
Created January 27, 2017 17:56
Get .CSV from gmail and copy it to a Google Spreadsheet
var targetFile = "SPREADSHEETKEY"; // Output file
var targetSheet = "SHEETNAME"; // output sheet
function Main() {
var CurrentDate = new Date() ;
var CurrentDateFormat = Utilities.formatDate(CurrentDate, "GMT", "MM.dd.YYYY") ; // YOU CAN CHOOSE ANOTHER FORMAT HERE
var ss = SpreadsheetApp.openById('SHEETNAME');
var CSVDD = ss.getSheetByName('SHEETNAME');
@loonix
loonix / moveshelvesheettootherbranch.txt
Created August 7, 2017 08:46
Move Shelveset to another branch
Move Shelveset to a Different Branch in TFS
Want to move a shelveset to a different branch? It’s more painful than I realised, but not to worry, here’s exactly what you need to do.
Step 1: Preparation
Make sure your source branch and target branch are both up to date by running Get Latest Changes. If you don’t you may receive the error:
“Unable to determine the workspace.”
Make sure you’ve created your shelveset and there are no pending changes for either branch. This includes the changes you just shelved! If you don’t you may receive the error:
@loonix
loonix / PFX-TO-JKS-BUILD-SIGNED-APK
Last active August 21, 2017 09:19
Convert .PFX files into .JKS key and Build signed Android APK
If your certificate's file format is in pfx you will need to export it to a jks format. Follow these steps to do that:
* Access the following website and download KeyStore Explorer:
* http://keystore-explorer.org/downloads.html
* Open Key Store Explorer
* Open the key file (.pfx or other format)
* Type the certificate password
* Go to File > Save As
* Select JKS type and save it.
@loonix
loonix / tocXSL.xml
Created August 25, 2017 07:28
Table of Contents XSL
<xsl:template name="genTOC">
<fo:block break-after="page">
<fo:block space-after="5mm">Table of Contents</fo:block>
<xsl:for-each select="//PATH">
<fo:block text-align-last="justify">
<xsl:value-of select="./Name" />:
<fo:basic-link internal-destination="{generate-id(.)}">
<fo:leader leader-pattern="dots" leader-pattern-width="2mm" />
<fo:page-number-citation ref-id="{generate-id(.)}" />
@loonix
loonix / XSL-FO - Helpers
Last active December 11, 2017 11:50
XSL-FO Check if Value is EMPTY or NULL or has a SPACE
<!-- Example when tag is like this <Category /> -->
<xsl:if test="./Category">
1
</xsl:if>
<xsl:if test="not(./Category)">
2
</xsl:if>
<xsl:if test="./Category != ''">
@loonix
loonix / date.xsl
Created October 26, 2017 09:41
This will format a xsl-fo date to "DD/MM/YYY HH:MM" from a format "YYYY-MM-DDTHH:MM:SS
<!--This will format a date to "DD/MM/YYY HH:MM" from a format "YYYY-MM-DDTHH:MM:SS"-->
<xsl:variable name="dt" select="./When"/>
<xsl:value-of select="concat(substring($dt, 9, 2),'/',substring($dt, 6, 2),'/',substring($dt, 1, 4),' ', substring($dt, 12, 2),':',substring($dt, 15, 2))"/>
@loonix
loonix / gist:a70ef802ef8906adb177c0d405f52e2f
Last active July 30, 2018 09:05
Failed to install 'cordova-plugin-crosswalk-webview': Error: Unhandled "error" event. (Parsing ...\platforms\android\res\xml\config.xml failed)
If the version is 8 then follow these steps.
$ cordova -v
8.0.0
Modify the line 33--34 in your_project/plugins/cordova-plugin-crosswalk-webview/hooks/update_config.js
// platformConfigurationFile = path.join(androidPlatformDir,
// 'res', 'xml', 'config.xml'),
platformConfigurationFile = path.join(androidPlatformDir,
'app', 'src', 'main', 'res', 'xml', 'config.xml'),
@loonix
loonix / highlight-and-flash-cell-slickgrid.ts
Created April 9, 2019 15:20
SlickGrid on cell change highlight and flash cell and apply class
/*
<angular-slickgrid gridId="importGrid" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions"
[dataset]="dataset" (onAngularGridCreated)="angularGridReady($event)"
(sgOnCellChange)="onCellChanged($event.detail.eventData, $event.detail.args)" <----- required
>
</angular-slickgrid>
*/
@loonix
loonix / find-match.service.spec.ts
Created April 18, 2019 11:52
Find Best Match Typescript
import { TestBed, inject } from '@angular/core/testing';
import { FindMatchService } from './find-match.service';
describe('FindMatchService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [FindMatchService]
});
});
@loonix
loonix / par-ou-impar.alg
Last active October 21, 2021 22:00
[Portugol] Verificar se numero e par ou impar #portugol
// Ler um numero e escrever se o numero e par ou impar
inicio
variavel inteiro numero
variavel real quociente
variavel inteiro resto
variavel inteiro resto2
escrever "Introduza numero: "
ler numero