Skip to content

Instantly share code, notes, and snippets.

View rheinardkorf's full-sized avatar

Rheinard Korf rheinardkorf

View GitHub Profile
@rheinardkorf
rheinardkorf / onename-verify.txt
Created January 11, 2016 04:57
OneName Verify
Verifying that +rheinardkorf is my blockchain ID. https://onename.com/rheinardkorf
@rheinardkorf
rheinardkorf / chrometabs.swift
Last active February 23, 2016 13:30
Chrome Tabs to Markdown - Redo of https://gist.github.com/rheinardkorf/faf652ef9dba66b2e555, but this time using Swift. Again, best used as a TextExpander snippet.
#!/usr/bin/swift
// @author: Rheinard Korf
import Foundation
// We need this struct to make life easier
struct TabItem {
var title: String
var name: String
var link: String
@rheinardkorf
rheinardkorf / loading-wp-editor-instance.php
Created April 18, 2016 00:55
Example of loading WP Editor scripts outside of normal context. No need for dummy editor hackery.
<?php
// Hook in the editor's `enqueue_scripts` function
add_action( 'some_footer_action', array( '_WP_Editors', 'enqueue_scripts' ) );
// Some function that's going to render in the page footer
function some_footer_render_function() {
do_action( 'some_footer_action' );
}
@rheinardkorf
rheinardkorf / 0_reuse_code.js
Created September 20, 2016 06:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rheinardkorf
rheinardkorf / slack-sso.php
Last active September 30, 2016 00:28
Very basic implementation of a Slack SSO plugin.
<?php
/*
Plugin Name: Slack SSO
Plugin URI: https://gist.github.com/rheinardkorf/91431d6e8e7b5070730352321876d5d3
Description: Sign into your WordPress site with Slack.
Version: 0.1-alpha
Author: Rheinard Korf
Author URI: https://gist.github.com/rheinardkorf/91431d6e8e7b5070730352321876d5d3
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
/**
* Whitelist embedded links in the REST API responses
*
* This is often useful if you want to only get specified resources embedded along with the
* main resources, rather than the "all of nothing" approach of passing `?_embed` to the API request.
*
* You can either pass a comma seperated list of relationships or an array of string via the `_embed_include` query param.
*
@rheinardkorf
rheinardkorf / docker-compose.yml
Created March 14, 2017 04:18
WordPress running on official WordPress Alpine version and official Alpine PHP-FPM version.
version: '2'
services:
nginx:
image: nginx:1.10.3-alpine
ports:
- 80:80
- 443:443
volumes:
- ./htdocs:/var/www/html

Keybase proof

I hereby claim:

  • I am rheinardkorf on github.
  • I am rheinard (https://keybase.io/rheinard) on keybase.
  • I have a public key ASB9TuTMvilmuznN6BgU_qlDotTEDiz199xdsUWbOVqnnwo

To claim this, I am signing this object:

@rheinardkorf
rheinardkorf / enable-wp-oauth-ui.php
Last active November 12, 2017 21:33
Enable the WP API OAuth Server consumer UI to create key pairs without using WP CLI.
<?php
/*
Plugin Name: Enable OAuth UI
Plugin URI: https://gist.github.com/rheinardkorf/dab0f0f46b814e1a7d1d
Description: Allows you to create consumer key pairs without WP CLI and the ability to name them for each APP. Must have WP API Oauth Server plugin active.
Version: 0.1
Author: Rheinard Korf
Author URI: https://gist.github.com/rheinardkorf/
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@rheinardkorf
rheinardkorf / phpcompat.php
Last active November 17, 2017 02:56
Example snippet to determine supported PHP versions using PHPCompatibility sniffs and phpcs.
<?php
function check_compatibility( $audit_files_directory, $phpcs_report_file, $phpcompat_report_file, $lowest_version = '5.2' ) {
// Official PHP versions.
// Note: Does not include patch releases as PHPCompatibility doesn't get this granular.
$php_versions = array(
'5.2',
'5.3',