Skip to content

Instantly share code, notes, and snippets.

View Ultrabenosaurus's full-sized avatar

Dan Bennett Ultrabenosaurus

  • UK
View GitHub Profile
@Ultrabenosaurus
Ultrabenosaurus / standard_ebooks_opds_downloader.py
Last active July 5, 2022 00:50 — forked from AnalogJ/download_opds.py
Download all ebooks from the Standard eBooks OPDS catalogue, organised into subfolders by author and book title.
#####
#
# Download all of the Standard eBooks catalogue from their OPDS feed.
#
# https://standardebooks.org/
#
# Modified to download all files for each book except the SVG cover and to
# organise the files in subfolders by Author > Book Title.
# The original script downloads only the EPUB file for each book into the
# working directory with no subfolders.
@Ultrabenosaurus
Ultrabenosaurus / 4.5
Created January 15, 2016 12:08 — forked from TimBlock/4.5
// Your code here.
function every(array,predicate){
for(var i = 0; i<array.length; i++){
if (!predicate(array[i]))
return false;
}
return true;
}
function some(array,predicate){

ajax.x - The XMLHttpRequest object (or MS equivalent) used for communication

ajax.serialize(f) f = the form element you wish to be serialized This function serializes all the fields in a form so that they can be passed as a query string in the form 'arg1=val1&arg2=val2'.

ajax.get(url, func) url = the url to query (can contain arguments after a '?') func = the function to call once the response is returned This function uses a GET request to query the specified url and return a response to the specified function.

// taken from http://stackoverflow.com/a/6969486/1734964
// saved for my own laziness
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}