Skip to content

Instantly share code, notes, and snippets.

View broox's full-sized avatar
🤠
hey

Derek Brooks broox

🤠
hey
View GitHub Profile
@broox
broox / 1-README.md
Last active November 21, 2023 14:26
Nuxt composable REST API Caching

I have a Nuxt 3 app that hits a rest API in order to display a paginated list of blog previews. Each preview can be tapped on to view the entire blog.

My app interfaces with 2 API endpoints.

  1. GET /api/v1/blogs returns a paginated listing of blogs.
  2. GET /api/v1/blog/:slug returns a single blog by an identifier.

Goals

Make as few server/API requests as possible, since much of the data can be easily cached on the client-side.

Keybase proof

I hereby claim:

  • I am broox on github.
  • I am broox (https://keybase.io/broox) on keybase.
  • I have a public key ASC1cUW6T_ejc26qUbO1dVFY3uCkyzNrtIHbSPRhcVe9GQo

To claim this, I am signing this object:

@broox
broox / 23_newtons_sqrt.go
Last active December 16, 2015 08:19
Here are some of my solutions to the exercises at tour.golang.org. This felt like I was in college again...
package main
import (
"fmt"
)
func Sqrt(x float64) (float64, int) {
var i, z = 1, 1.0
for ; i < 11; i++ {
@broox
broox / export_sobi_pro_data.sql
Last active March 30, 2018 11:04
Export data from Joomla's Sobi Pro via MySQL pivot table query
/*
* Export the data generated by this query to create fields from the custom rows
* stored in jos_sobipro_field.
*/
SELECT CONCAT("MAX(CASE WHEN f.nid = '",nid,"' THEN d.baseData END) AS ", nid, ", ")
FROM `jos_sobipro_field`
ORDER BY nid;
/*
@broox
broox / .gitignore
Created October 12, 2012 00:00 — forked from harperreed/.gitignore
chicago card crawler - A crawler for the chicago card plus website.
config.py
*.log
*.csv
*.pyc
@broox
broox / Haversine.md
Created April 15, 2012 15:56
Haversine Distance Formulas

Haversine Formula

used to calculate the great circle distance between two points on the earth (specified in decimal degrees)

Earth's Radius

  • Miles: 3956
  • Kilometers: 6371

Javascript