Skip to content

Instantly share code, notes, and snippets.

View balupton's full-sized avatar
:bowtie:
Back to work from backpacking, give me a few weeks to catch up

Benjamin Lupton balupton

:bowtie:
Back to work from backpacking, give me a few weeks to catch up
View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@cowboy
cowboy / very-small-ie-detect.js
Created August 21, 2010 13:26 — forked from padolsey/gist:527683
Very small IE detect (aka type coersion ftw)
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 6) then:
// ie === 0
// If you're in IE (>=6) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@balupton
balupton / README.md
Created May 18, 2011 13:44
JavaScript VS CoffeeScript

CoffeeScript VS JavaScript

The code examples are actually taken directly from an early version of DocPad before and after tha javascript rewrite. We now handle these cases a lot better in terms of callback hell by utilising task groups with bal-util, however the issue of the readability and error proneness of the verbose syntax in javascript is key these code examples.

There is also a larger issue that I see at the core of JavaScript, which is detailed in the following email response:

Question: Would ES6's implementation of easier classes in JavaScript, make you consider moving back to JavaScript from CoffeeScript?

Answer: Well there are lot more issues in JavaScript than its current complexity with writing code.

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@balupton
balupton / DocPad Nifties.md
Last active October 13, 2015 20:07
DocPad Nifties
@jhs
jhs / rant.md
Last active December 10, 2015 09:18
Rant about Node.js library logging

What I want for library logging

I write Node.js libraries, and I want logging. Why is this so problematic?

Note, I am despairing about how library authors log stuff not how application builders decide on a logging framework.

Hopefully this document can become a spec or feature list for code I will write some day.

The antipattern

@bewest
bewest / README.md
Last active February 28, 2017 01:49
using travis-ci to build using docpad, and publish to github pages

use travis-ci to publish to github

Demo

docpad

The docpad-plugin-ghpages uses the following information to stitch a new repo with contents of ./out directory onto root of your gh-pages branch:

  • git config user.email
  • git config user.name
@balupton
balupton / README.md
Last active December 23, 2015 12:09
A comparison of animal vs plant products