Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
🍜
focusing on pho

Louis Maddox lmmx

🍜
focusing on pho
View GitHub Profile
@lmmx
lmmx / JS generator.js
Last active August 29, 2015 14:01
Journal feed title cleanup
// prelist = RSSformatter.textile
list = prelist.split('\n'); //length = 30
itemlist = [];
for (i=0;i<list.length;i++) {
ind2 = list[i].substr(1).indexOf('|') + 1;
ind3 = list[i].substr(ind2+1).indexOf('|') + 1 + ind2;
item1 = list[i].substring(1,ind2);
item2 = list[i].substring(ind2+1,ind3);
item1 = item1.replace(/\[\\S\\s\]/,'|');
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lmmx
lmmx / docsdl.js
Last active August 29, 2015 14:01
Google Docs PDF DL
// list = array of Google Docs URLs e.g. from OneTab using .split('\n')
downloads = [];
for (i=0;i<list.length;i++) {
docKey = list[i].match(/\/d\/(.*?)\//)[1];
downloads.push('https://docs.google.com/document/d/'+docKey+'/export?format=pdf');
}
// downloads contains export links (suitable for bulk download by import into OneTab with .join('\n')
picurls = [];
picurls.push(document.querySelector('#view_original a').href);
picPush = function() {
picurls.push(document.querySelector('#view_original a').href);
ind = document.querySelector('.lightbox-index-text-container').innerText.split(' of ');
if (ind[0] == ind[1]) {
picsout = picurls.join('\n');
console.log(picsout);
picPush = function() {};
@lmmx
lmmx / baseencodecompare.js
Last active August 29, 2015 14:02
Compare base encoding results for a given string
function base(b, n){ var o = []; while(n > 0){ o.push(n%b); n = Math.floor(n/b); } return o; };
function based(basenum, num) {
result = [];
res = base(basenum,num);
for (i=0;i<res.length;i++){
result.push(res[i].toString(36));
}
return result.join('') + ' ' + result.join('').length+' characters';
}
@lmmx
lmmx / XHRxml.js
Last active August 29, 2015 14:02
scoops
mapsxhr = new XMLHttpRequest();
mapsxhr.open("GET","http://naivelocus.com/sitemap.xml",true);
mapsxhr.send();
mapsxhr.onreadystatechange = function(){
if (mapsxhr.readyState === 4 && mapsxhr.status==200){
sitemaps = mapsxhr.responseXML;
templist = sitemaps.querySelectorAll('loc');
sitemaplist = [];
for (l=0;l<templist.length;l++) {
sitemaplist.push(templist[l].innerHTML);
@lmmx
lmmx / PPIdatabases.js
Last active August 29, 2015 14:02
Parsing the Nucleic Acids Research molecular biology online database collection
dbdb = [
{
"name": "3D-Interologs",
"url": "http://gemdock.life.nctu.edu.tw/3D-Interologs/",
"entryurl": "http://www.oxfordjournals.org/nar/database/summary/1042",
"desc": "Protein-protein interactions in various evolutionary lineages",
"ref": null,
"absurl": "",
"email": "moon@faculty.nctu.edu.tw"
},
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Oxford Journals | Life Sciences | Nucleic Acids Research | Database Summary Paper </title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<style type="text/css" media="screen">
@import "/resource/css/main.css";
@import "/resource/css/general_page.css";
@lmmx
lmmx / consoleVMreader.js
Created June 23, 2014 13:09
JS console output to array from clipboard
// paste multiline output as variable 'list'
ar = [];
for (var i = 0; i < list.split(' ').length; i++) {
if(i % 2 === 0) { // index is even
ar.push(list.split(' ')[i]);
}
}
// the rest is processing dbdb.js entries