Skip to content

Instantly share code, notes, and snippets.

View ronsims2's full-sized avatar
🏀
Ballin'

Ron Sims II ronsims2

🏀
Ballin'
View GitHub Profile
@ronsims2
ronsims2 / 00-README-NEXT-SPA.md
Created March 30, 2023 13:19 — forked from rxs182/00-README-NEXT-SPA.md
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.

@ronsims2
ronsims2 / array_chunk.js
Created February 5, 2018 20:21 — forked from subimage/array_chunk.js
Javascript array chunk
// Splits an array into equal sized chunks
Array.prototype.chunk = function(pieces) {
pieces = pieces || 2;
var len = this.length;
var mid = (len/pieces);
var chunks = [];
var start = 0;
for(var i=0;i<pieces;i++) {
var last = start+mid;
if (!len%pieces >= i) {
@ronsims2
ronsims2 / index.html
Created December 25, 2016 02:42 — forked from anonymous/index.html
Flashcards Flashcards // source https://jsbin.com/zutape
<!DOCTYPE html>
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<meta name="description" content="Flashcards">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Flashcards</title>
<style id="jsbin-css">
.card-back {
@ronsims2
ronsims2 / index.html
Created September 22, 2015 12:34 — forked from anonymous/index.html
JS Bin Adventure Engine // source https://jsbin.com/vuvexa
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Adventure Engine" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
(function(w){
@ronsims2
ronsims2 / index.html
Created September 22, 2015 12:30 — forked from anonymous/index.html
JS Bin [Javascript object orderer] // source https://jsbin.com/dirixi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[Javascript object orderer]" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@ronsims2
ronsims2 / index.html
Last active August 29, 2015 14:25 — forked from anonymous/index.html
Simple Lorem Ipsum Tool for Web Designers (Needs jQuery)
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="foo" style="background:red;">123
</div>