Skip to content

Instantly share code, notes, and snippets.

View tobystokes's full-sized avatar

Toby Stokes tobystokes

View GitHub Profile
@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 {
@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 / 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 / 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 / gist:74ac7f7c058a7493036d
Created July 14, 2015 15:25
GREP multiline comments
/\*([\s\S]*?)\*/
@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
}
/// Function to get next map item
/// returns next map item or fallback value if map, key or next item does not exist
///
/// @author Simon Koch, Toby Stokes
///
/// @access public
///
/// @param {Map} $map - Sass list map
/// @param {String} $key - List map key of the current item
/// @param {String} $fallback (false) - Fallback value if map, key or next item does not exist. If this is 'loop' then returns the first item in the list
@tobystokes
tobystokes / gist:22824647af13d2808e65d0fd3997d9b7
Last active May 25, 2017 09:56
Generate self signed cert for local development, without Chrome SAN warnings
# replace [local.dev] with your domain
# You will still get ERR_CERT_COMMON_NAME_INVALID - but that can be solved by using the standard add to keychain and trust method
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout server.key \
-new \
-out server.crt \
// line 27ish
// ID selectors are naughty!
// The :active state only applies if .active isn't
li.active .c-btn-filter,
li:not(.active) .c-btn-filter:active,
li:not(.active) .c-btn-filter:focus {
color: grey(80);
Registered in England № 10455912, 60 Gray’s Inn Road, Unit G1, London, England, WC1X 8AQ. Homelyfe is a trading name of AG Lyfe Ltd (FCA Registration 775185), which is an appointed representative of Vibe MGA Management Ltd (FCA Registration 770419), which is authorised and regulated by the Financial Conduct Authority.