Skip to content

Instantly share code, notes, and snippets.

View michaelfagan's full-sized avatar

Michael Fagan michaelfagan

View GitHub Profile
@michaelfagan
michaelfagan / fb_friends_2_families.js
Last active June 27, 2020 03:01
when run on a facebook friends list, outputs a list of families
var by_name = {};
function url2names(u) {
var url_name = u.match(/\.com\/[^?#\\.]+\.([^?#\/]+)/)
if (!url_name || url_name[1] === 'php') {
return [];
}
return url_name[1].replace(/\d/g, '').replace(/\.$/, '').replace(/-/g, '.').split('.');
}
@michaelfagan
michaelfagan / dna_match_filter.js
Created November 2, 2019 19:37
Hide DNA matches on Ancestry and 23andMe below a threshold for the ratio of total shared DNA to longest segment
javascript:var mint=42;var minr=12;if (location.href.indexOf('23andme')!==-1) {$('#peeps li').each(function(){var e=$(this).find('.b3:last');var m=e.text().trim().match(/([^%]+)[^\d]+(\d+)/);var n=parseInt(m[2]);var t=parseFloat(m[1])*75;var r=t/n;if(t<mint||r<minr){$(this).hide()}else{e.prepend('Ratio '+Math.round(r*100)/100+', ')}})}else {
$('match-entry').each(function(){var b=$(this).find('.dnaGrayDark');var s=b.text().match(/(\d+)[^\d]+(\d+)/);var t=parseInt(s[1]);var r = t/parseInt(s[2]);if(t<mint||r<minr){$(this).hide()}else{b.prepend('<strong>Ratio '+Math.round(r*100)/100+'</strong> ')}})}