Skip to content

Instantly share code, notes, and snippets.

View kmelve's full-sized avatar
💬
is typing

Knut Melvær kmelve

💬
is typing
View GitHub Profile
@kmelve
kmelve / atekstcurl.sh
Created November 7, 2013 13:54
Enkelt skript for å enkelt laste ned mange pdf-versjoner av originale avissider fra ATEKST. Tips: Velg «utvidet søk og sett antall søkeresulater til 100. Klikk «Velg alle» ovenfor søketreffene, velg så neste side og trykk samme knapp. ATEKST tar vare på alle valgene selv om du skifter side. Når du har det du trenger velg «Lagre» og som «ren teks…
#!/bin/bash
for i in `cat url.txt`
# Your mileage may vary.
do curl -v $i -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Host: ret.nu' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.48 Safari/537.36' -L --compressed -O
done
@kmelve
kmelve / previouspage.js
Created November 18, 2013 07:08
Javascript/jQuery console input for calling the previous page in ATEKST search results. Works as input in Shortcut Manager for Chrome.
jQuery('.previousResultPage a:first')[0].click()
@kmelve
kmelve / nextPage.js
Created November 18, 2013 07:13
Javascript/jQuery console input for calling the next page in ATEKST search results. Works as input in Shortcut Manager for Chrome.
jQuery('.nextResultPage a:first')[0].click()
@kmelve
kmelve / selectAll.js
Created November 18, 2013 07:14
Javascript console input for choosing all search results in ATEKST. Works with Shortcut Manager for Chrome.
document.getElementById("selectAll").click();
@kmelve
kmelve / autotooltipnotes.js
Created November 27, 2013 19:34
jQuery for autogenerating Foundation tooltips from multimarkdown→HTML generated footnotes. First version. Iterations to come.
var notes = []
$('.footnotes p').each(function() {
notes.push($(this).text().replace('↩',''))
});
$('sup').each(function (index) {
$(this).wrap("<span data-tooltip class=\"has-tip\" title=\"" + notes[index] + "\"></span>");
});
@kmelve
kmelve / word generated html footnotes to bigfoot.js
Last active May 23, 2020 02:44
Takes HTML with footnotes generated in Word and – using jQuery – converts it to syntax compatible with [Bigfoot.js](http://cmsauve.com/labs/bigfoot/). I use it for a wordpress install. This is the first iteration of the code, and it can certainly be improved. I guess most of it can be done in pure Javascript.
var notes = [];
$('a[href*="ftnref"]').each(function (i) {
n = i + 1;
notes.push($(this[i]).parent().text());
$(this).parent().wrap('<li class="footnote" id=fn:' + n + '>' + notes[i] + '</li>');
$(this).remove();
});
$('.footnote').parent().wrapAll('<div class="footnotes" />');
$('div > .footnote').unwrap();
$('.footnotes').wrapInner('<ol></ol>');
@kmelve
kmelve / squarespacebigfootfooterinjection
Last active January 3, 2016 05:28
My Bigfoot-js implementation on Squarespace.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="/s/bigfootmin.js"></script>
<link rel="stylesheet" type="text/css" href="/s/bigfoot-number-dwpd.css">
<script type="text/javascript">
$.bigfoot({
positionContent: true, // required for numbered footnotes
numberResetSelector: 'article', // restarts the numbering for each article on SQ
actionOriginalFN: 'ignore' // show the original list of footnotes
});
</script>
@kmelve
kmelve / progressbar.css
Last active February 24, 2019 11:23
jQuery snippet for making a progressbar for reading position in browser.
#progresswrapper {
position: fixed;
top: 0px;
height: 2px;
width: 100%;
z-index: 1000;
}
#progressbar {
top: 0;
position: fixed;
@kmelve
kmelve / stoppord_no
Created February 7, 2014 19:18
Norske stoppord
å
alle
andre
at
av
både
båe
bare
begge
ble
@kmelve
kmelve / CodekitTransmit
Created March 6, 2014 09:46
AppleScript for uploading changes after CodeKit compiles. From https://github.com/bdkjones/codekit2beta/issues/273#issuecomment-36380800
tell application "Transmit"
set myFave to item 1 of (favorites whose name is "NameOfFavorite")
set myRules to (skip rules whose name is "codekit")
tell current tab of (make new document at end)
connect to myFave
change location of local browser to path "~/Codekit/Projekt"
change location of remote browser to path "domains/domain/assets"
synchronize local browser to remote browser using skip rules myRules
close remote browser
close