Skip to content

Instantly share code, notes, and snippets.

View florianpasteur's full-sized avatar

Florian PASTEUR florianpasteur

View GitHub Profile
@florianpasteur
florianpasteur / .bashrc
Last active May 22, 2024 09:29
Bash profile
#!/bin/bash
# START=$(perl -MTime::HiRes=time -e 'printf "%.9f\n", time')
#######################################################
# EXPORTS
#######################################################
# Expand the history size
@erquhart
erquhart / selection-command.js
Last active February 29, 2024 10:31
Text selection commands for Cypress.io
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
@amabes
amabes / Mock-FileList-for-Unit-Test-Angular2
Last active September 15, 2023 10:55
Simplified example to demonstrate how to Mock a FileList for unit testing purposes.
// Method to test
public uploadFileList(files: FileList) {
// whatever
}
// Test
it("uploadFileList", () => {
const blob = new Blob([""], { type: "text/html" });
blob["lastModifiedDate"] = "";
blob["name"] = "filename";
@miguelmota
miguelmota / base64-to-png.js
Created September 24, 2014 21:33
Base64 to PNG in Node.js
var fs = require('fs');
var path = require('path');
function base64ToPNG(data) {
data = data.replace(/^data:image\/png;base64,/, '');
fs.writeFile(path.resolve(__dirname, '../tmp/image.png'), data, 'base64', function(err) {
if (err) throw err;
});
}