Skip to content

Instantly share code, notes, and snippets.

View jordanthomas's full-sized avatar
✌️
v chill

Jordan Thomas jordanthomas

✌️
v chill
View GitHub Profile
@jordanthomas
jordanthomas / SassMeister-input-HTML.html
Created May 28, 2014 01:06
Generated by SassMeister.com.
<div class="one">&nbsp;</div>
<div class="one-alt">&nbsp;</div>
<div class="two">&nbsp;</div>
<div class="two-alt">&nbsp;</div>
<div class="three">&nbsp;</div>
<div class="three-alt">&nbsp;</div>
<div class="four">&nbsp;</div>
<div class="four-alt">&nbsp;</div>
<div class="five">&nbsp;</div>
<div class="five-alt">&nbsp;</div>
@jordanthomas
jordanthomas / timetravel.rb
Created May 14, 2014 14:24
Screenshots of your project
#!/usr/bin/ruby
# Script to checkout each revision of a middleman project and take a screenshot.
require 'fileutils'
commits = `git rev-list master`.split("\n").reverse
resolution = '1400x900'
url = 'http://127.0.0.1:4567/'
step = 20 # Step by this many commits after each screenshot.
@jordanthomas
jordanthomas / jaro-winkler.js
Last active April 7, 2021 00:50
The Jaro-Winkler distance metric in JavaScript. See also: https://github.com/jordanthomas/jaro-winkler
var distance = function(s1, s2) {
var m = 0;
// Exit early if either are empty.
if ( s1.length === 0 || s2.length === 0 ) {
return 0;
}
// Exit early if they're an exact match.
if ( s1 === s2 ) {
<!doctype HTML>
<html>
<body>
<a href="javascript:(function() {
var blur = 8,
style = 'blur(' + blur + 'px)';
if ( document.body.style.webkitFilter.indexOf(style) === -1 ) {
document.body.style.webkitFilter = style;
} else {
@jordanthomas
jordanthomas / clone.coffee
Created August 28, 2013 19:22
Array clone
Array::clone = ->
@slice 0
@jordanthomas
jordanthomas / levenshtein.js
Created August 14, 2013 20:31
Implementation of the Levenshtein distance algorithm in javascript.
function difference(s, t) {
if ( s === t ) {
return 0;
}
if ( s.length === 0 ) {
return s.length;
}
if ( t.length === 0 ) {
@jordanthomas
jordanthomas / thumbnails.sh
Created August 14, 2013 14:59
Create thumbnails from images in current directory.
#!/bin/bash
images=$(ls | grep -e '.[jpg|png]$')
for image in $images
do
base=$(basename "$image")
name="${base%.*}"
echo "Thumbnailing $image..."
convert "$image" -thumbnail 140x140^ -gravity center -extent 140x140 "${name}_thumb.jpg"
@jordanthomas
jordanthomas / random.js
Last active December 16, 2015 20:10
Random string helpers.
// Some helpers to generate random testing data; a seeder for javascript.
(function() {
'use strict';
///////////////////////////////////////////////////////////////////////////
// UTILITIES
// Methods for stuff like generating numbers and transforming text.
///////////////////////////////////////////////////////////////////////////
var utils = {
String::slugify = ->
map =
'à':'a'
'á':'a'
'ä':'a'
'â':'a'
'è':'e'
'é':'e'
'ë':'e'
'ê':'e'
@jordanthomas
jordanthomas / jquery.dealwithit.js
Created December 13, 2012 21:05
Deal With It for the web
(function ( $, window, document, undefined ) {
var pluginName = 'dealWithIt',
defaults = {
speed: 7000
};
function DealWithIt( element, options ) {
this.element = element;
this.options = $.extend( {}, defaults, options) ;
this._defaults = defaults;