Skip to content

Instantly share code, notes, and snippets.

View stvnrynlds's full-sized avatar
🤖
beep boop bop

Steven Reynolds stvnrynlds

🤖
beep boop bop
View GitHub Profile
function isbnLookup(id) {
var url = "https://www.googleapis.com/books/v1/volumes?country=US&q=isbn:"+id;
var options = {contentType : "application/json"};
var resp = UrlFetchApp.fetch(url, options);
if (resp == null || resp == "") return "N/A";
var respdata = JSON.parse(resp.getContentText());
if (respdata["items"].length == 0) return "Not found";
return respdata["items"][0]["volumeInfo"]["title"];
}
@stvnrynlds
stvnrynlds / HTMLVideoElement.js
Last active July 6, 2018 21:12
Properties and methods of the HTML video element
/*
Sources:
- MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
- WHATWG: https://html.spec.whatwg.org/multipage/embedded-content.html#media-element
*/
// METHODS
video.load(); // Reload video; No args
video.play(); // Play video; No args
video.pause(); // Pause video; No args
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 3, 2024 18:53
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"