Skip to content

Instantly share code, notes, and snippets.

@vhsu
vhsu / clasp
Created June 12, 2018 16:17
App Scripts Commands
https://github.com/google/clasp
npm install @google/clasp -g
clasp login
clasp clone <project id> (you should navigate in the correct file : dir (ls), cd) use clasp list to find some ids
clasp push
clasp pull
clasp open <project id> ( if not already defined)
Create an immutable version op project
@vhsu
vhsu / Google App script - Post a Google Form.js
Created May 28, 2018 16:52
Submit a Google Form from App Script (Google Spreadsheet)
//https://stackoverflow.com/questions/20410497/use-app-scripts-to-open-form-and-make-a-selection?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
// Simulate POST to form
function sendHttpPost() {
// Copy the entire URL from <form action>
var formAction = "https://docs.google.com/forms/d/e/KEY/formResponse";
var payload = {
"entry.888888888": "6689898", // Number
@vhsu
vhsu / gist:ea1e832262265b93d87528819caa1062
Last active May 25, 2018 12:41 — forked from alisterlf/gist:3490957
JAVASCRIPT:Remove Accents
//Lowercase Only Version
function RemoveAccents(strAccents) {
var strAccents = strAccents.split('');
var strAccentsOut = new Array();
var strAccentsLen = strAccents.length;
var accents = 'àáâãäåòóôõöøèéêëðçÐìíîïùúûüñšÿýž';
var accentsOut = "aaaaaaooooooeeeeecdiiiiuuuunsyyz";
for (var y = 0; y < strAccentsLen; y++) {
if (accents.indexOf(strAccents[y]) != -1) {
strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1);
@vhsu
vhsu / pystanInstall.txt
Last active May 26, 2018 10:47
Pystan Windows Reinstall
1 . Open CMD.exe as ADMIN
2. Install Chocolatery : @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
https://chocolatey.org/install
3. Update Python : choco install python --pre
https://chocolatey.org/packages/python
4. Install Anaconda : https://www.anaconda.com/download/
@vhsu
vhsu / Google Ad Authorized Single Keywords.txt
Created April 18, 2018 17:55
Google Ad Authorized Single Keywords 16.04.2018
donere da 4/16/2018
donation da 4/16/2018
ngo da 4/16/2018
ngo'er da 4/16/2018
almennyttig da 4/16/2018
nonprofitorganisationer da 4/16/2018
velgørenhedsorganisationer da 4/16/2018
hjemløs da 4/16/2018
hjemløshed da 4/16/2018
MOOC da 4/16/2018
@vhsu
vhsu / Suisseograntsscript.js
Last active February 24, 2024 23:14
Google Grants Report Google Ads Script By Suisseo (Single Account Script)
/**********************************************************************************************************************
This Google Ads script checks a single Google grants account for mandatory requirements and logs the results in a Google Spreadsheet
UPDATED : 23.02.2024 : Updated to v16 api + updated the adgroup counting to consider DSA (thanks Frederique Boitelle for reporting this issue).
Author : Suisseo (Vincent Hsu)
More Info : https://www.suisseo.ch/en/blog/google-ad-grants-script/
1. Detect if Campaigns are set to 'maximize conversion' to allow bids higher that 2 dollars
2. Detect if each Campaign has at least 2 active ad groups with at least 2 active text (or at least 1 RSA)
3. Detect if each account has at least 2 active Sitelinks
4. Detect if each campaign has geo-targeting .
@vhsu
vhsu / GetAdsByID.js
Created January 28, 2018 15:13
Adwords Script : Get Ads By ID
function main() {
var inc=0;
var adGroupSelector = AdWordsApp
.adGroups()
.forDateRange("ALL_TIME")
.withCondition("Clicks > 10")
.orderBy("Clicks DESC");
var adGroupIterator = adGroupSelector.get();
while (adGroupIterator.hasNext()) {
@vhsu
vhsu / AddKW.js
Created January 27, 2018 10:26
Adwords Script - Add KeyWords Based on Ad group Name
//-----------------------------------
// Create Keywords based on Ad Group Name
//
// : Ads a new Ad with a headline using the keyword with the most impressions
// Author : Vincent Hsu
// Website: http://www.suisseo.ch
//-----------------------------------
// Done for France
function main() {
index=0;
@vhsu
vhsu / varbyclassname.js
Created October 18, 2017 14:32
Custom Variable Tagmanager - Log a custom message in a variable by class name
function() {
if(document.getElementsByClassName('alert')[0])
{
return document.getElementsByClassName('alert')[0].textContent;
}
else
{
return false;
}
}
@vhsu
vhsu / forex.csv
Created September 25, 2017 21:01
Forex Keyword DB
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 12 in line 1.
// Vincent Hsu @suisseo
forex;22200;11.97;0.97;229000000;0.45,0.45,0.45,0.55,0.55,0.55,0.67,0.55,0.67,0.82,0.67,0.99
trader forex;3600;7.42;0.96;4760000;0.66,0.66,0.55,0.66,0.82,0.82,0.82,0.82,0.82,0.99,0.82,0.99
wa-forex;3600;0.05;0.46;5960000;0.11,0.20,0.24,0.36,0.44,0.67,0.67,0.55,0.82,0.99,0.82,0.67
forex trading;2900;15.29;0.94;50600000;0.66,0.66,0.99,0.82,0.82,0.82,0.82,0.55,0.66,0.66,0.55,0.66
forex factory;2400;2.19;0.33;3440000;0.66,0.66,0.83,0.66,0.83,0.66,0.55,0.66,0.66,0.99,0.99,0.99
broker forex;880;5.92;0.93;6510000;0.62,0.81,0.99,0.55,0.55,0.55,0.37,0.37,0.45,0.45,0.62,0.45
forex en ligne;720;0.05;0.87;5950000;0.30,0.30,0.30,0.77,0.77,0.99,0.45,0.37,0.45,0.55,0.55,0.99
forum forex;720;2.58;0.89;26300000;0.67,0.99,0.82,0.82,0.99,0.99,0.67,0.67,0.99,0.67,0.99,0.67
forex broker;720;7.66;0.91;10600000;0.48,0.48,0.48,0.72,0.88,0.88,0.88,0.59,0.88,0.72,0.88,0.99