Skip to content

Instantly share code, notes, and snippets.

View tobystokes's full-sized avatar

Toby Stokes tobystokes

View GitHub Profile
@tobystokes
tobystokes / listenWithMe.js
Created February 26, 2016 16:32 — forked from orrybaram/listenWithMe.js
Add an embedded spotify player that plays the track your currently listening to (or last listened to) Demo at http://orryb.com/projects/currentSpotify/
var ListenWithMe = (function() {
// Add your own config here
var LASTFM_API_KEY = "";
var LASTFM_USERNAME = "";
// Element to inject the widget into
var $playerWrapper = document.getElementById('spotify-player-wrapper');
return {
init: init
}
@tobystokes
tobystokes / gist:74ac7f7c058a7493036d
Created July 14, 2015 15:25
GREP multiline comments
/\*([\s\S]*?)\*/
@tobystokes
tobystokes / index.php
Created May 22, 2014 10:40
set language folder based on cookie or browser.
<?php
//previous visits will hopefully have lang cookie set. if no cookie, try browser lang
$lang = (isset($_COOKIE["lang"])) ? $_COOKIE["lang"] : substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang) {
case 'en':
header('Location: /en/');
break;
@tobystokes
tobystokes / mixin-lang.scss
Created May 22, 2014 10:15
SASS target languages mixin
// select by language, send it one or more comma separated quote-delimited locale codes
// assuming lang attribute is set on the html tag, like it should be!
// usage: @include if-lang("de") {}
// usage: @include if-lang("de", "en", "cn-ZH") {}
@mixin if-lang($locales...) {
@for $i from 1 through length($locales) {
html[lang=#{nth($locales, $i)}] & {
@content;
}
@tobystokes
tobystokes / SassMeister-input.scss
Created January 28, 2014 18:45
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
//interpolation bug in libsass example
$one: one;
$two: two;
.variabubble {
@tobystokes
tobystokes / SassMeister-input.scss
Created January 23, 2014 19:12
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
//interpolation bug in libsass example
$authors: Markus Huber, Jasmin Pakbeen, Richard Wiltshire, Ishaq Siddiqi, Mark Priest, Joe Rundle, Lucas Rouxdeluze, Adrien Cohen, Monira Lor, Max Stigliano;
// this on it's own works:
@each $name in $authors {