Skip to content

Instantly share code, notes, and snippets.

@hharzer
hharzer / keybase.md
Created October 30, 2022 15:50
keybase.md

Keybase proof

I hereby claim:

  • I am hharzer on github.
  • I am hrhrzr (https://keybase.io/hrhrzr) on keybase.
  • I have a public key ASBv7d5YKG3DvlUvctMQQKDjXRiLkEMyuR7sy-IKLrU3iQo

To claim this, I am signing this object:

@hharzer
hharzer / README.md
Created February 22, 2022 12:55 — forked from D2theR/README.md
Auto-generates Serializers & ModelViewSets in a Django API using just models

Why?

I got sick of writing the same Serializer & ModelViewSet classes over and over so I found and wrote some code to do it for me, and somehow it works! Please note that there are a lot of caveats to running an API like this and while this may work, I know there's A LOT of room for improvement, feel free to fork and help!

USAGE

Import the router module to your main sites urls.py file as the injection point like so... Make sure to remove any other imports from other viewsets that you don't need that may conflict!

@hharzer
hharzer / index.html
Created August 11, 2021 01:22
Live Markdown Editor
<div class="grid">
<div class="grid__row">
<div class="grid__col grid__col--4">
<textarea class="js-input"># An exhibit of Markdown
This note demonstrates some of what [Markdown][1] is capable of doing.
*Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.*
### Keybase proof
I hereby claim:
* I am hharzer on github.
* I am hrhrzr (https://keybase.io/hrhrzr) on keybase.
* I have a public key ASBzusxzsKqjsj-EL4Hs0qzJXnZm1B29YOcok9VdsLJ38Qo
To claim this, I am signing this object:
@hharzer
hharzer / expose-response-headers.md
Created August 6, 2020 02:24 — forked from n400/expose-response-headers.md
Example observers to expose response headers from FaunaDB JS driver

When the FaunaDB JavaScript driver returns query results, it's exposing the the response payload, but not the response headers. However, the response headers contain query metrics you might want (e.g., read ops, write ops, transaction retires, query time, bytes in/out, storage bytes read/written, read ops).

The web shell/REPL at dashboard.fauna.com also presents this information to you through the GUI (click the "i" on left).

Here are some examples to help you get the repsonse headers

@hharzer
hharzer / nested-fql-manual.js
Created August 6, 2020 01:50 — forked from ptpaterson/nested-fql-manual.js
Template for building deeply nested FQL queries for FaunaDB
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms));
// or
// const baseQuery = q.Paginate(q.Collection(collectionName))
const expandedQuery = q.Map(baseQuery, (ref) =>
q.Let(
{
instance: q.Get(q.Var('ref'))
},
{
@hharzer
hharzer / index.js
Created August 5, 2020 05:39 — forked from PierBover/index.js
Micro router for Cloudflare Workers
const router = require('./router');
router.setRoutes([
{
path: '/ping',
method: 'GET',
handler: ping
},
{
path: '/hello/:name',
@hharzer
hharzer / Design document
Created May 19, 2020 02:11 — forked from rdmpage/Design document
Full text search in Cloudant
{
"_id": "_design/lookup",
"_rev": "2-2763d098bce604230bfc247ca06cba05",
"language": "javascript",
"indexes": {
"all": {
"index": "function(doc) {\n if (doc.title)\n {\n index(\"title\", doc.title, {\"store\": \"yes\"});\n }\n }"
}
}
}
@hharzer
hharzer / datatables-json-sample-using-material-design.markdown
Created September 12, 2019 17:56
DataTables JSON sample using Material Design

DataTables JSON sample using Material Design

Using Material Design table for DataTables JSON sample data

A Pen by hharzer on CodePen.

License.