Skip to content

Instantly share code, notes, and snippets.

View vbresan's full-sized avatar

Viktor Brešan vbresan

View GitHub Profile
@vbresan
vbresan / Code.gs
Created March 23, 2024 06:12 — forked from nizioleque/Code.gs
Google Calendar events bulk edit (with Google Apps Script)
function start() { main(); }
// CONFIGURE BELOW ------------------------------------------------
const Test = true;
const TestFn = events => {
const testEvent = events[0];
console.log(testEvent);
const response = updateEvent(testEvent);
@vbresan
vbresan / parseInputNumber.js
Created October 26, 2021 14:55
Simplifies string in currency format. Removes all thousands separators, keeps only decimal separator. Separators can be "," or ".".
function parseInputNumber(value) {
let last = Math.max(value.lastIndexOf(","), value.lastIndexOf("."));
if (last == -1) {
return value;
}
let parts = value.split(/[.,]/);
let parsed = parts.slice(0, -1).join("");
@vbresan
vbresan / countries.js
Created October 26, 2021 14:51 — forked from tmrk/countries.js
An array of all countries with ISO 3166-1 alpha-2, alpha-3 and numeric country codes, as well the numeric codes for sub-regions, regions and continents as specified by the United Nations Statistics Division at http://unstats.un.org/unsd/methods/m49/m49.htm (August 2016).
var countries = [
{ 'name' : 'Afghanistan', 'alpha2' : 'AF', 'alpha3' : 'AFG', 'num3' : '004', 'subregion' : '034', 'region' : '', 'continent' : '142' },
{ 'name' : 'Åland Islands', 'alpha2' : 'AX', 'alpha3' : 'ALA', 'num3' : '248', 'subregion' : '154', 'region' : '', 'continent' : '150' },
{ 'name' : 'Albania', 'alpha2' : 'AL', 'alpha3' : 'ALB', 'num3' : '008', 'subregion' : '039', 'region' : '', 'continent' : '150' },
{ 'name' : 'Algeria', 'alpha2' : 'DZ', 'alpha3' : 'DZA', 'num3' : '012', 'subregion' : '015', 'region' : '', 'continent' : '002' },
{ 'name' : 'American Samoa', 'alpha2' : 'AS', 'alpha3' : 'ASM', 'num3' : '016', 'subregion' : '061', 'region' : '', 'continent' : '009' },
{ 'name' : 'Andorra', 'alpha2' : 'AD', 'alpha3' : 'AND', 'num3' : '020', 'subregion' : '039', 'region' : '', 'continent' : '150' },
{ 'name' : 'Angola', 'alpha2' : 'AO', 'alpha3' : 'AGO', 'num3' : '024', 'subregion' : '017', 'region' : '', 'continent' : '002' },
{ 'name' : 'Anguilla', 'alpha2' : 'AI', 'alpha3' : 'AIA', 'num3' :
@vbresan
vbresan / gglCalEventsOnSpreadSheet.gs
Created October 4, 2021 18:52 — forked from paucoma/gglCalEventsOnSpreadSheet.gs
Script to read Google Calendar Events and Count total Hours
const gblFrom = {
year : 2020 ,
month : 3,
day : 29,
hour : 0
};
const gblTo = {
year : 2020 ,
month : 8,
day : 1,