Skip to content

Instantly share code, notes, and snippets.

Rheinard Korf rheinardkorf

Block or report user

Report or block rheinardkorf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View amplify_auth_gatsby_config.md

First attempt...

Inside gatsby-browser.js

import Amplify, { Auth } from 'aws-amplify';
import awsconfig from './src/aws-exports'
Amplify.configure(awsconfig);
@rheinardkorf
rheinardkorf / with-theme-path.js
Created Apr 22, 2019
For posterity. Manually trying to implement component shadowing with Gatsby. So glad this is backed in by default.  😅
View with-theme-path.js
exports.withThemePath = (relativePath, root = __dirname) => {
const qualifiedPath = relativePath.replace('./src', `${root}/src`);
let qualifiedResolvedPath = path.resolve(qualifiedPath);
let finalPath = qualifiedResolvedPath;
const theme = path.basename(root);
const themedPath = relativePath.replace('./src', `./src/${theme}`);
let themedResolvedPath = path.resolve(themedPath);
try {
View brew-instructions.sh
# Install `dnsmasq` and configure for *.dev domains
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Reload configuration and clear cache
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ dscacheutil -flushcache
View gist:0daa5531c60a6c8733b805f29f4d20c1
<?php
/**
* Init Proxy endpoints.
*
* @return void
*/
public function rest_api_init() {
/**
@rheinardkorf
rheinardkorf / slack-verify.php
Last active Aug 4, 2018
Verifying Slack Requests
View slack-verify.php
<?php
/**
* Validate Slack notification signature.
*
* @see https://api.slack.com/docs/verifying-requests-from-slack
*
* @param array $headers POST headers.
* @param string $response_body JSON string of body.
* @param string $signing_secret Slack secret.
@rheinardkorf
rheinardkorf / index.html
Created Jul 24, 2018
Cloudinary DAM Widget Example
View index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Demo</title>
<script src="https://media-library.cloudinary.com/global/all.js"></script>
<script type="text/javascript">
const mloptions = {
cloud_name: '<CHANGE_THIS>',
api_key: '<CHANGE_THIS>',
@rheinardkorf
rheinardkorf / Dockerfile
Created Jun 8, 2018
Add MongoDB PHP driver (with SSL) to Docker image
View Dockerfile
# Get and make mongodb PHP driver
RUN yes | apt-get install libssl-dev \
&& git clone https://github.com/mongodb/mongo-php-driver.git --recursive \
&& cd mongo-php-driver \
&& phpize \
&& ./configure --with-mongodb-ssl=openssl \
&& make all \
&& make install \
&& echo "extension=mongodb.so" > /opt/php${SHORT_VERSION}/lib/conf.d/ext-mongodb.ini \
&& cd .. \
@rheinardkorf
rheinardkorf / snakeymap.go
Created May 28, 2018
Convert `map[string]interface{}` into a new `map[string]interface{}` with all keys converted to snake_case.
View snakeymap.go
package snakeymap
func SnakeKeyMap(data map[string]interface{}) map[string]interface{} {
converted := make(map[string]interface{})
for key, val := range data {
goodKey := snakeKey(key)
switch v := val.(type) {
case map[string]interface{}:
@rheinardkorf
rheinardkorf / Makefile
Created Feb 23, 2018
Makefile for building and bundling a Go app as MacOS Application.
View Makefile
TITLE=My Title
BUNDLE_ID=com.rheinardkorf
PROJECT=MyApp
EXEC=app
VERSION=0.1
define plist
<?xml version="1.0" encoding="UTF-8"?> \
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@rheinardkorf
rheinardkorf / main.go
Created Feb 15, 2018
Go: BTCMarkets Authentication Example
View main.go
package main
import (
"crypto/hmac"
"time"
"strconv"
"fmt"
"net/http"
"io/ioutil"
"crypto/sha512"
You can’t perform that action at this time.