Skip to content

Instantly share code, notes, and snippets.

Christian Lawson-Perfect christianp

Block or report user

Report or block christianp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@christianp
christianp / README.md
Created Mar 27, 2019
MathJax for mastodon
View README.md

These patches are based off Mastodon v2.7.1. They will probably need some work to apply to future releases.

mathjax.diff adds MathJax to render LaTeX. You need a copy of MathJax under the URL /MathJax. Write inline maths between \( and \), and display-mode maths between \[ and \].

autolatex.diff adds automatic replacement of some LaTeX with unicode equivalents in the toot compose box. It only applies to text not within LaTeX delimiters, so doesn't interfere with MathJax.

@christianp
christianp / bank-note-names.ipynb
Created Nov 27, 2018
Names of scientists nominated to appear on the new £50 note
View bank-note-names.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@christianp
christianp / mathsjam-2018-compo-compo-compo.ipynb
Created Nov 18, 2018
Working-out for the lowest-entry-not-in-an-arithmetic-sequence with other entries competition
View mathsjam-2018-compo-compo-compo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View chicken-wing-prices.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View A249067.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View sqrt fact floor 2018.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 2018-sqrt-floor-fact.py
from math import factorial, sqrt, floor
id = lambda x: x
commands = {
's': sqrt,
'f': floor,
'!': factorial,
}
@christianp
christianp / README.md
Last active Nov 9, 2017
Get MathJax on mastodon v2.0.0
View README.md
@christianp
christianp / everyones-a-mathematician.js
Created Oct 17, 2017
Everyone's a Mathematician bookmarklet
View everyones-a-mathematician.js
javascript:(function() {function textNodesUnder(el){ var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false); while(n=walk.nextNode()) a.push(n); return a; }; var nodes=textNodesUnder(document.body); var lowercase = 'a-zàèìòùáéíóúýâêîôûãñõäëïöüÿçßøåæœ'; var uppercase = 'A-ZÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÄËÏÖÜŸÇØÅÆ'; var one_name = '['+uppercase+']['+lowercase+']+\\.?'; var re_name = new RegExp('((?:(?:'+one_name+'(?:-'+one_name+')*|(?:['+uppercase+']\\.)+)(?: (?:(?:['+uppercase+']\\.)+|'+one_name+'(?:-'+one_name+')*))* (?:(?:de|von|van|ibn) |(?:ibn )?al-|el-|d\')?'+one_name+'(?:-'+one_name+')*)|Euclid|Archimedes|Pythagoras|Brahmagupta|Eudoxus|Fibonacci|Aryabhata|Apollonius|Diophantus|Bháscara|Hipparchus|Archytus|Panini|Aristotle|Pappus|Hippocrates|Thales)','g'); Array.prototype.map.call(nodes,function(n){ n.textContent = n.textContent.replace(re_name,'Mathematician $1')}) })()
View single-quote-in-exam-file.exam
// Numbas version: exam_question_groups
{"name": "Single quote in .exam file", "extensions": [], "resources": [], "navigation": {"showfrontpage": false, "preventleave": false, "allowregen": true}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "<p>it's OK</p>", "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": [], "rulesets": {}, "variables": {}, "functions": {}, "metadata": {"licence": "None specified", "description": ""}, "preamble": {"css": "", "js": ""}, "name": "Single quote in .exam file", "tags": [], "parts": [], "variable_groups": [], "ungrouped_variables": [], "advice": ""}]}]}
You can’t perform that action at this time.