Skip to content

Instantly share code, notes, and snippets.

View jordanstephens's full-sized avatar
🌲

Jordan Stephens jordanstephens

🌲
View GitHub Profile
class LazyPager
include Enumerable
def initialize(&block)
@page = 0
@block = block
@items = []
@index = 0
end
@jordanstephens
jordanstephens / fleetio-openapi.yaml
Created November 7, 2022 19:44
Fleetio OpenAPI Specification
openapi: 3.0.0
info:
title: Fleetio Developer API
version: '1.0'
contact:
name: Fleetio Support
email: help@fleetio.com
url: https://www.fleetio.com/contact
description: |-
## Getting Started
@jordanstephens
jordanstephens / keybase.md
Created August 25, 2020 20:29
keybase.md

Keybase proof

I hereby claim:

  • I am jordanstephens on github.
  • I am jordanstephens (https://keybase.io/jordanstephens) on keybase.
  • I have a public key whose fingerprint is 126F 251B CDF3 D5CE E87B 1C70 3DBB BC2D AC16 A1AA

To claim this, I am signing this object:

// cycle(0, 1, 3) // => 1
// cycle(1, 1, 3) // => 2
// cycle(2, 1, 3) // => 0
// cycle(0, -1, 3) // => 2
// cycle(1, -1, 3) // => 0
// cycle(2, -1, 3) // => 1
export default function cycle(i, d, n) {
return (i + (n + d)) % n;
}
@jordanstephens
jordanstephens / bbox-union.js
Last active January 5, 2016 22:34
calculate bbox union of selected svg elements
// example usage:
// bBoxUnion("svg > *") => Object {x: 464.9, y: 521.0, width: 319.75, height: 75.5}
function bBoxUnion(selector) {
var nodeList = document.querySelectorAll(selector),
nodeArray = Array.prototype.slice.call(nodeList);
return nodeArray.reduce(function(memo, node) {
if (node.getBBox) {
var bBox = node.getBBox();
@jordanstephens
jordanstephens / loading.svg
Created August 14, 2015 17:31
loading.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jordanstephens
jordanstephens / aaia_tsv_to_yml.rb
Created November 19, 2012 18:10
convert aaia car list tsv to ymm yaml
require 'yaml'
ARGV.each do |arg|
cars = []
File.readlines(arg).each do |line|
row = line.split("\t")
year = row[1]
make = row[2].capitalize
@jordanstephens
jordanstephens / gist:3640465
Created September 5, 2012 17:23
swap stylesheet medias between screen and print
jQuery('link[rel=stylesheet]').each(function() {
var $t = jQuery(this), p = 'print', s = 'screen', m = 'media';
if ($t.attr(m) === p) { $t.attr(m, s); } else if ($t.attr(m) === s) { $t.attr(m, p); }
});
@jordanstephens
jordanstephens / gist:3518425
Created August 29, 2012 20:26
Using the parent selector (&) in a SASS mixin
Pleasantly surprised to find that this works with SASS, saved me a lot of typing.
@mixin foo {
& bar {
//...
}
}
baz {
@include foo;