Skip to content

Instantly share code, notes, and snippets.

View gpetz's full-sized avatar
🎯
Focusing

Georg Petz gpetz

🎯
Focusing
View GitHub Profile
@gpetz
gpetz / strollview
Last active November 30, 2021 15:23
{
"@context": [
"http://www.w3.org/ns/anno.jsonld",
"https://seige.digital/strollview/2/context.jsonld"
],
"id": "https://strollid.manducus.net/gpetz/870612b0c9e1d3ed7a80557c4ec6f366",
"type": "AnnotationCollection",
"creator": "",
"label": "",
"rights": "",
@gpetz
gpetz / pubmed
Created September 9, 2014 09:08
pubmed autocomplete to jquery
<!DOCTYPE html>
<html>
<head>
<!--http://hublog.hubmed.org/archives/001879.html-->
<title>Using PubMed's autocomplete data in JQuery</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#search").submit(function() {
Search PubMed for articles in the PMC Open Access Subset for which free full text (i.e. XML) is available:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=xml&term=pubmed+pmc+open+access%5Bfilter%5D+AND+free+full+text%5Bfilter%5D
Find the PMCID for an article by PMID:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&db=pmc&retmode=xml&linkname=pubmed_pmc&id=24191168
Fetch full text article XML from PMC by PMCID:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&id=3804407
A PMC article for which the full text XML is not available:
@gpetz
gpetz / extract_word_test
Last active August 29, 2015 14:05
How to extract word from a string given a position in php
<?php
for ($i = 0; $i <= 30; $i++) {
$test = extractWord("durchfall fieber kinder", $i);
echo $i . ": " . $test . "\n";
}
function extractWord($text, $position) {
$words = explode(' ', $text);
$characters = -1;