Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / external-links.js
Created March 22, 2014 19:52
Open links in an new tab
@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 / 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 / _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;
Model = require "lib/model"
class Card extends Model
defaults:
name: ""
value: ""
transform: (name, value)->
@luk3thomas
luk3thomas / gulpfile.coffee
Last active August 29, 2015 14:11
working example of gulp, coffeescript, react, jsx, browserify
sys = require "sys"
exec = require("child_process").exec
spawn = require("child_process").spawn
browserify = require "browserify"
watchify = require "watchify"
coffee_react = require "coffee-reactify"
gulp = require "gulp"
jade = require "gulp-jade"
plumber = require "gulp-plumber"
reload = require "gulp-livereload"
toArray = (d) -> [].slice.call(d)
currify = (fn, args, remaining)->
if remaining < 1
return fn.apply(null, args)
->
currify(fn, args.slice(0, fn.length - 1).concat(toArray(arguments)), remaining - arguments.length)