Skip to content

Instantly share code, notes, and snippets.

@adeel
adeel / arXiv-download.js
Created October 16, 2022 01:18
bookmarklet for downloading pdf from arXiv (with filename: "Author1-Author2 - Title.pdf")
var title = $$("h1.title")[0].innerText;
var authors = $$(".authors a").map(a => a.innerText.split(" ").pop()).join("-");
var link = $$("a.download-pdf")[0];
link.download = authors + " - " + title + ".pdf";
link.click();
@adeel
adeel / roam-mathjax.js
Created September 9, 2020 12:40
Enable MathJax in Roam (this goes in roam/js).
window.MathJax = {
tex: {
inlineMath: [["$","$"]],
displayMath: [["\\[","\\]"]],
processEscapes: true,
}
};
(function() {
var script = document.createElement("script");
@adeel
adeel / gist:ba01e1ca611b4ea455b94628ac09bbd4
Created February 22, 2019 04:41
CompilerException when running `lein ring server-headless`
❯ lein ring server-headless
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/fn at (clojure/core/unify.clj:83:18).
#:clojure.error{:phase :macro-syntax-check, :line 83, :column 18, :source "clojure/core/unify.clj", :symbol clojure.core/fn}
at clojure.lang.Compiler.checkSpecs (Compiler.java:6971)
clojure.lang.Compiler.macroexpand1 (Compiler.java:6987)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7092)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7094)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.access$300 (Compiler.java:38)

Keybase proof

I hereby claim:

  • I am adeel on github.
  • I am preschema (https://keybase.io/preschema) on keybase.
  • I have a public key ASAxeUXSSO0Q6cuYqAiQ2-XCbBlF3ZMOZXAewxfkzMMwWgo

To claim this, I am signing this object:

@adeel
adeel / nlab_definition.js
Created January 7, 2015 11:24
bookmarklet to insert the template for a definition environment (for nLab editors)
// Save the following as a bookmark:
// javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3Bvar%20str%20%3D%20%22%2B--%20%7B%3A%20.un_defn%7D%5Cn%5C%23%23%23%23%23%23%20Definition%5Cn%5Cn%5C%3D--%5Cn%22%3Bvar%20caretPos%20%3D%20document.getElementById(%22content%22).selectionStart%3Bvar%20textareaVal%20%3D%20%24(%22%23content%22).val()%3B%24(%22%23content%22).val(textareaVal.substring(0%2C%20caretPos)%20%2B%20str%20%2B%20textareaVal.substring(caretPos))%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
function runInstikiDefnBookmarklet() {
var str = "+-- {: .un_defn}\n\
###### Definition\n\n\
=--\n";
var caretPos = document.getElementById("content").selectionStart;
var
@adeel
adeel / arXiv_citation.js
Last active October 20, 2018 07:50
arXiv citation bookmarklet
// Save the following as a bookmark:
// javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3Bvar%20authors%20%3D%20%24(%22.authors%20a%22).map(function()%20%7Breturn%20%22%5B%5B%22%20%2B%20%24.trim(%24(this).html())%20%2B%20%22%5D%5D%22%3B%7D).get().join(%22%2C%20%22)%3B%24(%22.title%20.descriptor%22).remove()%3Bvar%20title%20%3D%20%24.trim(%24(%22.title%22).html())%3Bvar%20arxivId%20%3D%20%24(%22.arxivid%20a%22).html()%3Bvar%20URL%20%3D%20location.href%3Bvar%20citation%20%3D%20%22*%20%22%20%2B%20authors%20%2B%20%22%2C%20_%22%20%2B%20title%20%2B%20%22_%2C%20%5B%22%20%2B%20arxivId%20%2B%20%22%5D(%22%20%2B%20URL%20%2B%20%22).%22%3Bwindow.prompt(%22Copy%20to%20clipboard%3A%20Ctrl%2BC%2C%20Enter%22%2C%20citation)%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F2.1.3%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.ready
% arrows
\newcommand{\too}{\longrightarrow}
\newcommand{\isoto}{\stackrel{\sim}{\longrightarrow}}
\newcommand{\hook}{\hookrightarrow}
\newcommand*{\longhookrightarrow}{\ensuremath{\lhook\joinrel\relbar\joinrel\rightarrow}}
\newcommand{\hooklong}{\longhookrightarrow}
\newcommand{\sub}{\subset}
% operators
\DeclareMathOperator*{\fibprod}{\times}
@adeel
adeel / instiki_to_mediawiki.py
Last active December 6, 2017 14:54
conversion script from instiki to mediawiki (in progress)
# instiki_to_mediawiki.py
from optparse import OptionParser
import os.path
import re
import cgi
import sys
import subprocess
category_regex = re.compile(r"(:)?category\s*:(.*)", re.IGNORECASE)
@adeel
adeel / itex2mml.php
Created March 31, 2014 20:19
A MediaWiki extension which adds support for itex2mml.
<?php
# itex2mml.php
# A MediaWiki extension which adds support for itex2mml.
if (!defined('MEDIAWIKI')) die();
$wgExtensionCredits['other'][] = array(
'name' => 'itex2mml',
'description' => 'Adds support for math via itex2mml.',
'version' => '0.1'
@adeel
adeel / plainnat-aky.bst
Last active December 23, 2015 15:59
a modification of the bibliography style `plainnat` provided by the package `natbib`, which uses a hyphen to separate multiple author names instead of " and ".
%% File: `plainnat-aky.bst'
%% A modification of `plainnat.bst' to use hyphens to separate
%% multiple author names instead of " and ".
%% See http://tex.stackexchange.com/questions/134512/using-an-en-dash-for-multiple-author-citations-with-natbib
%%
%% Modified on 22.9.2013 by AKY. The original author's comments
%% follow.
%%%%
%% File: `plainnat.bst'
%% A modification of `plain.bst' for use with natbib package