Skip to content

Instantly share code, notes, and snippets.

View mattneary's full-sized avatar

Matt Neary mattneary

View GitHub Profile
@jonashaag
jonashaag / 0-howto-listfield-django-admin.rst
Created September 7, 2011 09:41
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@mattneary
mattneary / index.js
Created March 8, 2012 00:54
Esoteric language with 2 vars and only recursive function calls
var parseLambda = function(string) {
var replacements = [
[/\^/g, "++x;"],
[/_/g, "--x;"],
[/\~/g, "++v;"],
[/\./g, "--v;"],
[/\$/g, "x"],
[/\#/g, "v"],
[/@/g, "return "],
[/!\(([^)]+)\)/g, "arguments.callee($1)"],
//TANK
int leftMotorPower(float leftJoyY, float rightJoyY, float leftJoyX, float rightJoyX) {
return leftJoyY * speed;
}
int rightMotorPower(float leftJoyY, float rightJoyY, float leftJoyX, float rightJoyX) {
return rightJoyY * speed;
}
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links
@jfmengels
jfmengels / lodash-fp-documentation.md
Last active February 6, 2024 20:57
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active July 3, 2024 08:44
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.