Skip to content

Instantly share code, notes, and snippets.


Francesco Stella francescostella

View GitHub Profile
francescostella / gist:c0bcd542d64aa12191a5724a45302527
Created Oct 17, 2018
Venetian/Palazzo referer detection for 'Back to' link
View gist:c0bcd542d64aa12191a5724a45302527
let referrerUrl = document.referrer;
let referrerUrlMatch = referrerUrl.match(/^https?:\/\/www\.(venetian|palazzo)\.com(?!\/meetings(\/|$))/);
let referrerName = referrerUrlMatch ? referrerUrlMatch[1] : null;

At that point, referrerName is either “venetian", "palazzo", or null (if referrer URL was from neither of the two sites, or if the path started with “/meetings/“), and the referrerUrl can be used as needed.

Examples: "” returns null

francescostella / SassMeister-input.sass
Created Jul 7, 2015
Generated by
View SassMeister-input.sass
// ----
// libsass (v3.2.5)
// ----
$char: "E008"
$res: ""
@for $i from 1 through 4
$res: $res + $char
You can’t perform that action at this time.