Skip to content

Instantly share code, notes, and snippets.

@vivascau
vivascau / ExemptVAT.js
Last active November 15, 2019 14:16
FreeAgent Assign `N/A` or `Exempt` VAT in Full report
const START_FROM_ENTRY_IN_LIST_NO = 8
const assign0VAT = () => {
const expense = document.querySelector(`#vat_purchases > tbody > tr:nth-child(${START_FROM_ENTRY_IN_LIST_NO}) > td:nth-child(2) > a`)
expense.click();
setTimeout(setValues, 1500);
}
const setValues = () => {
const purchase = document.querySelector('#purchase_sales_tax_rate');
@vivascau
vivascau / gist:5e664c85f4afeaee1716
Created December 23, 2014 15:21
get list of folders staged for commit
git status -s | cut -d " " -f2- | cut -d / -f4 | uniq - > [filename]
@vivascau
vivascau / multiplyFile
Created October 8, 2014 16:05
Use node.js to copy a file multiple times dynamically
/* global require, process, console */
var fs = require('fs');
for(var i=0; i<300; i++){
fs.createReadStream('wahteverFile.js')
.pipe(fs.createWriteStream('whateverFile'+i+'.js'));
}
@vivascau
vivascau / formFillHelper
Last active March 26, 2022 23:14
Fill in visible inputs of type text or number on a page based on an array
(function fillForms(){
var dataArr = ["REG_NUMBER","POST_CODE","REG_NUMBER","POST_CODE"], dataIndex = 0, i,
allInputs = document.getElementsByTagName("input");
for(i=0; i<allInputs.length; i++){
if(allInputs[i].style.display !== "none" &&
(allInputs[i].type==="text" || allInputs[i].type==="number" || allInputs[i].type==="tel")){
if(dataIndex >= dataArr.length){
return;
}
allInputs[i].value=dataArr[dataIndex];