Skip to content

Instantly share code, notes, and snippets.

View HomerJSimpson's full-sized avatar

Homer Simpson HomerJSimpson

  • New Jersey, USA
View GitHub Profile
@HomerJSimpson
HomerJSimpson / index.html
Created March 10, 2023 04:38
Look Ma no idp
<html>
<body class="flex-container">
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="buttonDiv" class="flex-item"></div>
<pre id="stuff" class="flex-item"></pre>
</body>
</html>
@HomerJSimpson
HomerJSimpson / index.html
Created February 3, 2023 23:23
MuiSimple
<div id="container">
</div>
@HomerJSimpson
HomerJSimpson / stub.js
Last active March 12, 2018 23:11
Select multiple terms in pdf.js
PDFViewerApplication.findController.executeCommand('find', {
query: 'from trace compiled',
highlightAll: true,
phraseSearch: false
})
@HomerJSimpson
HomerJSimpson / highlight.js
Created September 13, 2017 17:40
Add span to textnodes so can highlight on pdf text layer
function wrapText(container, text) {
// Construct a regular expression that matches text at the start or end of a string or surrounded by non-word characters.
// Escape any special regex characters in text.
var textRE = new RegExp('(^|\\W)' + text.replace(/[\\^$*+.?[\]{}()|]/, '\\$&') + '($|\\W)', 'm');
var nodeText;
var nodeStack = [];
// Remove empty text nodes and combine adjacent text nodes.
container.normalize();
@HomerJSimpson
HomerJSimpson / manifest.json
Created September 7, 2017 18:17
Google Chrome Content script to import bookmarks into Google Bookmarks through it's web ui
{
"name": "Content Script",
"description": "Do you really need a description for that?",
"version": "0.2",
"manifest_version": 2,
"content_scripts": [{
"run_at" : "document_end",
"matches": [ "*://*.google.com/bookmarks/mark*", "*://*.google.com/bookmarks/lookup*" ],
"js": ["script.js"]
}]
@HomerJSimpson
HomerJSimpson / default.conf
Last active June 26, 2017 17:44
reverse proxy for testing
server {
listen 80;
server_name localhost;
location /api/facet-suggest {
proxy_pass http://facet-suggest:3000/api/facet-suggest;
}
location /api/location {
proxy_pass http://location-search:3000/api/location;
@HomerJSimpson
HomerJSimpson / scrape.js
Created May 31, 2017 04:07
scrape cory doctorow's down and out in the magic kingdom audio book
// http://voicesinthedark.com/content.php?iContent=186
copy($$('img[src*="chapter"]').filter(x => x.parentNode.nextSibling.querySelector('span.listen>a')).map(x => `curl -Lo '${x.nextSibling.innerHTML}'.mp3 '${x.parentNode.nextSibling.querySelector('.listen>a:nth-child(1)')}'`).join('\n'))
Array.from({length:100}).map(function(e, i) { return i+1; });a.map(function(item, index) { return index % 10 === 0 ? a.slice(index, index + 10) : null }).filter(x => x);
[alias]
co = checkout
br = branch
st = status -uno
[user]
name = nick
email = nlehma@icims.com
[core]

notes

mongo with a data volume from another container

docker run \
	 --rm \
	 --name mongo \
	 --volumes-from mongo-data \
	 -p 27017:27017 mongo