Consider this blog post model:
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parseLambda = function(string) { | |
var replacements = [ | |
[/\^/g, "++x;"], | |
[/_/g, "--x;"], | |
[/\~/g, "++v;"], | |
[/\./g, "--v;"], | |
[/\$/g, "x"], | |
[/\#/g, "v"], | |
[/@/g, "return "], | |
[/!\(([^)]+)\)/g, "arguments.callee($1)"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; | |
} | |
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.