Skip to content

Instantly share code, notes, and snippets.

View chevcast's full-sized avatar

Alex Ford chevcast

View GitHub Profile

Step 1 - Redirect user to spotify so they can authorize their account.

res.redirect(
  `${spotifyRootUrl}/authorize?response_type=code&client_id=${spotifyClientId}&redirect_uri=${encodeURIComponent(redirectUri)}`
);

Step 2 - Create an endpoint for Spotify to redirect the user to and get the authorization code Spotify passed in.

app.get("/auth/spotify/callback", (req, res) => {
javascript:(function () {var s = document.createElement('script');s.setAttribute('src', '//fontbomb.ilex.ca/js/main.js');document.body.appendChild(s);}());
@chevcast
chevcast / emailRegex.js
Created October 2, 2014 02:35
HTML 5 Email Validation Regular Expression
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
router.get('/google', function (req, res) {
var url = 'http://www.google.com';
request(url, function (err, response, body) {
res.send(body.replace(/(action|src|href)="((?!http)[^"]*)"/gi, function (match, g1, g2) {
return g1 + '="' + url + g2 + '"';
}));
});
});