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 / check bookmarklet
Last active August 29, 2015 13:58
Delete bad tweets (bookmarklet)
javascript:(function(){ cb = function(){ create_spritz();}; var script=document.createElement('SCRIPT');script.src='https://gist.githubusercontent.com/lmmx/9852222/raw/1ab1740b53621481cea0b6bd80aa20fe34a7b095/Twitter+checker.js?callback=cb?callback=cb'; script.onload=cb; document.body.appendChild(script);})();
@lmmx
lmmx / Citation title grabber.js
Last active August 29, 2015 13:58
Citation title grabber
var titleList = [];
var paras = document.getElementsByTagName('p');
for (i=0;i<paras.length;i++) {
var thisPara = document.getElementsByTagName("p")[i].textContent;
var title = paras[i].textContent.match(/\d{4}.*?[\)]\.\s(.*?)\./);
if (title !== null) {
titleList.push(title[1]); // output is the 1st element of each array (input text = 0th)
} else {
title = paras[i].textContent.match(/\d{4}.*?[\)]\.?\s?(.*?)\./);
titleList.push(title[1]);
We couldn’t find that file to show.
sounds = document.getElementsByClassName('soundList__item')
for (i=sounds.length-1;i>=0;i--) {
if (sounds[i].innerHTML.match("Download") === null) {
sounds[i].remove()
}
}
clade: Mammal
genome: Human
assembly: Feb. 2009 (GRCh37/hg19)
group: All Tracks
track:
1000G Ph1 Accsbl
1000G Ph1 Vars
5% Lowest S
AceView Genes
Affy Exon Array
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 2 columns, instead of 1. in line 1.
tgpPhase1Accessibility 1000G Ph1 Accsbl
tgpPhase1 1000G Ph1 Vars
ntSssTop5p 5% Lowest S
acembly AceView Genes
affyExonArray Affy Exon Array
for (l=0;l<doilist.length;l++){
newBadge = document.createElement('div');
if (l=0 && document.querySelector('div.post').offsetLeft > 300) {lr='left';}
else {lr='right';}
newBadge.setAttribute('data-badge-popover',lr);
newBadge.setAttribute('data-badge-type','medium-donut');
newBadge.setAttribute('data-doi',doilist[l]);
newBadge.setAttribute('data-hide-no-mentions','true');
newBadge.className = "altmetric-embed";
document.getElementById('altmetBox').appendChild(newBadge);
@lmmx
lmmx / badgestylesheet.css
Last active August 29, 2015 14:00
Customised Altmetrics badges, using Javascript to scrape DOI's from within blog post links and produce Altmetrics links out to other content on the same papers.
.noshow, *:hover .noshow {
fill: transparent !important;
}
#altmetBox {
text-align: center;
}
#altmetBox > div.altmetric-embed {
width: 276px;
@lmmx
lmmx / Parse site map XML.js
Created May 6, 2014 21:46
Simple site map XML parsing in Javascript
xmlin = prompt(); // view-source:biochemistri.es/sitemap1.xml
parser = new DOMParser();
xmlDoc=parser.parseFromString(xmlin,"text/xml");
xmlDoc.querySelectorAll('loc')[0].remove();
posts = xmlDoc.querySelectorAll('loc');
postlist = [];
for (i=0;i<posts.length;i++) {postlist.push(posts[i].innerHTML)};
copy(postlist.join('\t')); // Chronological list of all posts as .tsv