Skip to content

Instantly share code, notes, and snippets.

@leemac
leemac / gatsby-node.js
Created December 6, 2020 21:19
Gatsby changes to hide drafts
const path = require(`path`)
const { createFilePath } = require(`gatsby-source-filesystem`)
const isProduction = process.env.NODE_ENV === `production`;
exports.createPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions
// Define a template for blog post
const blogPost = path.resolve(`./src/templates/blog-post.js`)
@leemac
leemac / keybase.md
Created August 15, 2016 16:18
Proving my identity

Keybase proof

I hereby claim:

  • I am leemac on github.
  • I am leemac (https://keybase.io/leemac) on keybase.
  • I have a public key whose fingerprint is 15F2 42D6 7097 65BB 7D49 7188 D1DF 2658 6F47 615F

To claim this, I am signing this object:

@leemac
leemac / DjangoQuerySetToJsonResponse.py
Created December 28, 2014 21:37
Example of returning a Django QuerySet as a JSON response (Django 1.7)
# Get the objects from the database
rawData = Launch.objects.all()
# Create array
json_res = []
# Iterate over results and add to array
for record in rawData:
json_obj = dict(name = record.name)
json_res.append(json_obj)