Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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
@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 / 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;