Skip to content

Instantly share code, notes, and snippets.

View matthewnolan's full-sized avatar

Matthew Nolan matthewnolan

View GitHub Profile
@matthewnolan
matthewnolan / keybase.md
Created November 9, 2020 13:02
keybase.md

Keybase proof

I hereby claim:

  • I am matthewnolan on github.
  • I am matthewnolan (https://keybase.io/matthewnolan) on keybase.
  • I have a public key ASCiPx5A3ul_FostuOuNd95vQP82YPxRmfgyfrxmYyUp9wo

To claim this, I am signing this object:

<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
@matthewnolan
matthewnolan / findPages
Last active December 20, 2015 05:49
JavaScript format page numbers like a printer dialog. "1,3,4-7" returns an array [1,3,4,5,6,7]
function findPages (pages) {
// usecase = "1-3,6,9";
if (typeof(pages) != "string"){ return }; // must be a string
var splitUse = pages.split(",") // ["1-3","6","9"]
var patt1 = new RegExp("-"); // search for -
for (i=0;i < splitUse.length;i++) {
if ( patt1.test(splitUse[i]) ){ // tests for "-"
var newsub = splitUse[i].split("-");
for (n=newsub[0]; n<=newsub[1]; n++){
splitUse.push(n); // adds contents to end of array