Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Ianfeather
Ianfeather / gist:fefaee82c2ac0e66fddd
Created March 17, 2015 14:30
List files using node and generators
'use strict';
var co = require('co'),
fs = require('co-fs'),
each = require('co-each');
var dive = function* (path) {
var items = yield fs.readdir(path);
// This is a utility function that breaks a URL into an object
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
function parseUri(d){for(var a=parseUri.options,d=a.parser[a.strictMode?"strict":"loose"].exec(d),c={},b=14;b--;)c[a.key[b]]=d[b]||"";c[a.q.name]={};c[a.key[12]].replace(a.q.parser,function(d,b,e){b&&(c[a.q.name][b]=e)});return c}
parseUri.options={strictMode:!1,key:"source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};
function getCampaignMedium(landinguri, campcode, refuri){
/**********Campaign managem
<head>
// If the user has a cookie don't render the critical css to the page
// Ensure it matches the md5 hash of our critical css so we can cache bust
- if cookies[:inline_css_cached] == critical_css_ref
// Instead get the styles from local storage
<script>
@Ianfeather
Ianfeather / gist:94a5e0b36521a95c2245
Created May 2, 2014 13:40
Colour ordering and proximity
require ['jquery'], ($) ->
$(".js-colours .js-select").on "change", (e) ->
sortBy(@value)
$(".js-colours .styleguide-proximity__input").on "keyup", (event) ->
return resetProximity() if (!event.target.value)
event.keyCode is 13 and matchProximity()
sortBy = (comparator) ->
sections = document.querySelectorAll(".styleguide-block")
@Ianfeather
Ianfeather / hiring.md
Created January 6, 2014 14:04
Come and work at Lonely Planet!

Unfortunately one of our key front end developers decided to leave Lonely Planet at the end of last year to pursue new avenues. As a consequence we're on the lookout for a new Front End Developer.

We're looking for someone who:

  • understands the complexities of big websites.
  • wants sites to be fast. Like, really fast - and will keep pushing for it.
  • is agnostic about the technology stack and will use the right tool for the job.
  • cares about the user experience, whether that relates to visual design, the website speed, or ensuring we can deliver new features fast enough.
  • understands the core concepts and benefits of continuous delivery (you don't need to be an expert or indeed to have worked in such an environment before).
@Ianfeather
Ianfeather / gist:8240922
Last active January 2, 2016 02:59
r.js path switching
// Is there a way to change a path for a specific module during the r.js build process?
// So that a module with a dependency of 'jquery' can be used with two versions?
// I have tried to show what I would be after with lines 16-18
({
baseUrl: "./",
paths: {
"jquery": "jquery/jquery-2.0"
},
modules: [
@Ianfeather
Ianfeather / SassMeister-input.sass
Created December 19, 2013 22:54
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// ----
// ****
// TOGGLE THIS VARIABLE TO SEE THE DIFFERENCE
$is-ie: false
@mixin respond-to($screen-width)
@Ianfeather
Ianfeather / SassMeister-input.sass
Created November 19, 2013 17:30
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$is-ie: true
@mixin respond-at($screen-width)
@if $is-ie == false
@media only screen and (min-width : #{$screen-width}px)
@Ianfeather
Ianfeather / proximity_loader.coffee
Last active December 23, 2015 03:39
Proximity loading for images/social scripts
# Really this is just a proximity_sensor, it will fire whatever event you pass as an arg
# It has nothing to do with loading, that's just how we've used it so far
required = if window.lp.isMobile then 'jsmin' else 'jquery'
define [required, 'lib/extends/events'], ($, EventEmitter) ->
class ProximityLoader
for key, value of EventEmitter
@Ianfeather
Ianfeather / gist:5955912
Created July 9, 2013 09:15
SpecRunner.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner</title>
<link rel="stylesheet" type="text/css" href=".grunt/grunt-contrib-jasmine/jasmine.css">