Skip to content

Instantly share code, notes, and snippets.

@luk3thomas
luk3thomas / _mixins.scss
Created April 21, 2014 16:54
Bootstraps's less mixins for sass, way back when
// Mixins.less
// Snippets of reusable CSS to develop faster and keep code readable
// -----------------------------------------------------------------
// IE7 inline-block
// ----------------
@mixin ie7-inline-block() {
*display: inline; /* IE7 inline-block hack */
*zoom: 1;
@luk3thomas
luk3thomas / broken.html
Last active August 29, 2015 13:59
JavaScript closure problem loop
<!--
console.log always says '10'
-->
<style>
#links {
padding:1em;
}
a {
text-decoration:none;
@luk3thomas
luk3thomas / menu-tree.js
Last active August 29, 2015 13:58
Recursive function for creating a menu object. The function takes a jQuery object and recursively builds a menu tree
var _links = function($lis, depth) {
return $.makeArray($lis.map(function(i, li) {
var $li = $(li),
$a = $li.find('> a'),
$children = $li.find('> .sub-menu > li'),
link = {
name: $a.text(),
href: $a.attr('href'),
depth: depth
};
@luk3thomas
luk3thomas / external-links.js
Created March 22, 2014 19:52
Open links in an new tab
@luk3thomas
luk3thomas / gulpfiles.js
Created March 22, 2014 18:59
Gulp example
var gulp = require('gulp')
, less = require('gulp-less')
, plumber = require('gulp-plumber')
, replace = require('gulp-replace')
, jshint = require('gulp-jshint')
, concat = require('gulp-concat');
var cfg = {
files: {
@luk3thomas
luk3thomas / readme.md
Last active August 29, 2015 13:55
Google Analytics track Facebook social actions

Add this directly after the opening <body> tag

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=477427382375494";
  fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));

@luk3thomas
luk3thomas / index.html
Last active January 4, 2016 21:29
Congressional Voting
<!DOCTYPE html>
<html>
<head>
<title>Congress Members</title>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<style>
body {
font: 12px/1.5 helvetica, sans-serif;
text-align:center;
}
@luk3thomas
luk3thomas / data.csv
Created January 26, 2014 02:18
St. Louis temperature
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 23 columns, instead of 11. in line 8.
CST,Max TemperatureF,Mean TemperatureF,Min TemperatureF,Max Dew PointF,MeanDew PointF,Min DewpointF,Max Humidity, Mean Humidity, Min Humidity, Max Sea Level PressureIn, Mean Sea Level PressureIn, Min Sea Level PressureIn, Max VisibilityMiles, Mean VisibilityMiles, Min VisibilityMiles, Max Wind SpeedMPH, Mean Wind SpeedMPH, Max Gust SpeedMPH,PrecipitationIn, CloudCover, Events, WindDirDegrees
2010-1-16,44,39,34,39,37,34,100,88,76,30.30,30.16,29.97,5,2,0,9,4,15,T,8,Fog,73
2010-1-17,41,37,32,36,33,30,100,90,79,30.00,29.93,29.88,10,4,0,14,9,18,0.00,7,Fog,320
2010-1-18,46,40,34,39,36,34,100,86,71,30.05,30.00,29.94,5,2,0,13,5,15,T,8,Fog,235
2010-1-19,39,36,32,36,34,31,100,93,85,30.01,29.95,29.87,4,2,0,14,7,18,0.00,8,Fog,77
2010-1-20,45,41,36,44,39,35,100,96,92,29.89,29.74,29.65,2,0,0,16,10,21,0.11,8,Fog-Rain,98
2010-1-21,43,39,35,43,38,33,100,96,92,29.79,29.63,29.53,9,2,0,16,11,20,0.29,8,Fog-Rain,34
2010-1-22,40,37,34,38,35,33,100,93,85,29.96,29.90,29.78,9,3,1,15,7,18,T,8,,21
2010-1-23,53,46,39,48,45,37,100,92,83,2
@luk3thomas
luk3thomas / data.csv
Last active January 4, 2016 05:59
Weather grid
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 23 columns, instead of 11. in line 8.
CST,Max TemperatureF,Mean TemperatureF,Min TemperatureF,Max Dew PointF,MeanDew PointF,Min DewpointF,Max Humidity, Mean Humidity, Min Humidity, Max Sea Level PressureIn, Mean Sea Level PressureIn, Min Sea Level PressureIn, Max VisibilityMiles, Mean VisibilityMiles, Min VisibilityMiles, Max Wind SpeedMPH, Mean Wind SpeedMPH, Max Gust SpeedMPH,PrecipitationIn, CloudCover, Events, WindDirDegrees
2010-1-16,44,39,34,39,37,34,100,88,76,30.30,30.16,29.97,5,2,0,9,4,15,T,8,Fog,73
2010-1-17,41,37,32,36,33,30,100,90,79,30.00,29.93,29.88,10,4,0,14,9,18,0.00,7,Fog,320
2010-1-18,46,40,34,39,36,34,100,86,71,30.05,30.00,29.94,5,2,0,13,5,15,T,8,Fog,235
2010-1-19,39,36,32,36,34,31,100,93,85,30.01,29.95,29.87,4,2,0,14,7,18,0.00,8,Fog,77
2010-1-20,45,41,36,44,39,35,100,96,92,29.89,29.74,29.65,2,0,0,16,10,21,0.11,8,Fog-Rain,98
2010-1-21,43,39,35,43,38,33,100,96,92,29.79,29.63,29.53,9,2,0,16,11,20,0.29,8,Fog-Rain,34
2010-1-22,40,37,34,38,35,33,100,93,85,29.96,29.90,29.78,9,3,1,15,7,18,T,8,,21
2010-1-23,53,46,39,48,45,37,100,92,83,2
@luk3thomas
luk3thomas / setup.md
Last active January 2, 2016 23:59
Python 2.6 project
  1. Install virtualenv pip install virtualenv. Installation instructions here
  2. virtualenv -p /usr/bin/python2.6 <path/to/new/virtualenv/>
  3. pip install -r requirements.pip