Skip to content

Instantly share code, notes, and snippets.

@fmarais
fmarais / javascript.txt
Last active August 10, 2022 16:14
PUBLIC_Youtube_quicksave_draft
const sleep = ms => new Promise(r => setTimeout(r, ms));
var title = "GOPRO - 24 July 22 - Atlantis L 2nd time";
var filenameEle = document.getElementById("original-filename");
var filename = filenameEle.innerText.substring(0, filenameEle.innerText.length - 4);
var title2 = title + " - " + filename;
var textbox = document.querySelector("#textbox");
textbox.innerText = title2;
document.querySelector(".use-placeholder .dropdown-trigger-text").click();
await sleep(500);
@fmarais
fmarais / PUBLIC_google_drive_sheets_backup_files.txt
Last active May 12, 2022 13:56
PUBLIC_google_drive_sheets_backup_files
// Sheet > Extensions > Apps Script
// Add Script
// Add trigger for script
// ------------------------------
// Backup script
function archiveCopy() {
var file = DriveApp.getFileById("original_file_id_to_backup");
var destination = DriveApp.getFolderById("backup_folder_name");
var timeZone = Session.getScriptTimeZone();
@fmarais
fmarais / backup.js
Created May 3, 2020 12:16
This script will automatically save spreadsheet sheets when edited in Google docs.
function myOnEdit() {
var fileId = "1Ly5SSIE9d-b_IA6VxDB1HF3pnf37SPf22KhZVv3PPiVA1w";
var folderId = "1S1F8NpjOfbxY_4n27llfqh6eOs3Kb1eojaq";
var file = DriveApp.getFileById(fileId);
var folder = DriveApp.getFolderById(folderId);
var now = new Date();
var fileNameDate = now.getFullYear() + "-" + zeroPrefix_(now.getMonth()+1) + "-" + zeroPrefix_(now.getDate()) + 'T' + zeroPrefix_(now.getHours()) + ":" + zeroPrefix_(now.getMinutes()) + ":" + zeroPrefix_(now.getSeconds())