Skip to content

Instantly share code, notes, and snippets.

@vhsu
vhsu / mobileadsOLD.js
Last active February 15, 2017 10:04
Create Mobile Ads Old Format
//-----------------------------------
// Create mobile preferred ads (use one with highest ctr)
// Ads a new Ad with a headline using the keyword with the most impressions
// Author : Vincent Hsu
// Website: http://www.suisseo.ch
// NB : This scipt is useless now since Mobile ads don't exist anymore, just storing stuff here
//-----------------------------------
function main() {
index = 0;
@vhsu
vhsu / 3letterdomainsCH.txt
Last active December 2, 2016 12:07
Available 3 letter .ch domain names 30.11.2016
// 3 letter domain names available
// Author : https://www.suisseo.ch
aiy.ch
ajq.ch
aqb.ch
aqr.ch
bqo.ch
bqu.ch
bxe.ch
bxi.ch
@vhsu
vhsu / getdalayerVariable.js
Last active December 1, 2016 15:33
Get Datalyer value
// Get single datalayer value from gtm in vanilla javascript
google_tag_manager["GTM-XXXXXXX"].dataLayer.get('variable')
// Retrieve value from google tag manager datalayer object in vanilla javascript
google_tag_manager["GTM-XXXXXXX"].dataLayer.get('variable')['purchase']['actionField']['revenue']
// To fetch the value from a javacript variable inside gtm of custom html you would use the following code from the same object
variable.purchase.actionField.revenue
@vhsu
vhsu / cloudflare-403.txt
Last active November 26, 2016 04:01
Cloudflare Blocking Server to Server requests 403
Recently we faced a problem with cloudflare blocking some server to server requests.
To fix the problem we simply created a page rule with the blocked ressource URL
And applied the following rule.
Browser Integrity Check : Off
Another solution would have been to simply add a user agent in the http request to avoid cloudflare from blocking it
@vhsu
vhsu / wpcf7-ip-shortcode-wordpress-cloudflare.php
Last active August 5, 2019 09:50
Override $_SERVER['REMOTE_ADDR'] for Wordpress with Contact form 7 [_remote_ip] shortcode and Cloudflare
// Override $_SERVER['REMOTE_ADDR'] on Wordpress to retrieve the client ip for cloudflare users
// This will also correct the [_remote_ip] shortcode with contact form 7 ( wpcf7 ) or any other plugin using $_SERVER['REMOTE_ADDR']
// Simply add the following code in the wp_config.php file and you're done.
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
@vhsu
vhsu / Twilio Free SMS stock alerts with Google Spreadsheet
Last active October 7, 2018 04:50
Twilio Free Sms Stock alerts with Google Spreadsheet
/**********************************************************************************************************************
//Check out the tutorial here : https://medium.com/@20cent.hsu/free-sms-stock-alerts-with-twilio-and-google-spreadsheets-1aa5dec7ef4c
//Realtime price quote in GOOGLEFINANCE can be delayed by up to 20 minutes.
//Author : Vincent Hsu (Suisseo)
//Twitter : @suisseo
**********************************************************************************************************************/
//These are mandatory parameters you will find in your twilio Dashboard
var ACCOUNT_SID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
var AUTH_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
@vhsu
vhsu / littlehack555.html
Created June 24, 2016 17:38
Align image and text inline mediaquery test
<h3>Hum Hum</h3>
<style>
.justalittlehack555 {
float:left;
margin:0px 10px 10px 0px;
}
@media only screen and (max-width:450px) {
.justalittlehack555 {
float:none;
display:block;
@vhsu
vhsu / Sitelinks Check ( Account Level)
Last active March 5, 2016 11:34
Check if sitelinks are broken : Adwords account level script
@vhsu
vhsu / Sitelinks Check ( MCC Script)
Last active March 5, 2016 11:35
Sitelinks Check ( MCC Script)
@vhsu
vhsu / gist:08c586c3621f486dd88a
Last active January 5, 2016 19:56 — forked from russorat/gist:7446125
AdWords Script to check sitelinks
function main() {
Logger.log('AdWordsApp.extensions().sitelinks() list.');
logSitelinks(AdWordsApp);
Logger.log('Campaign and AdGroup list.');
var campIter = AdWordsApp.campaigns().get();
while(campIter.hasNext()) {
var camp = campIter.next();
logSitelinks(camp);
var agIter = camp.adGroups().get();