Skip to content

Instantly share code, notes, and snippets.

Kevin McKernan mckernanin

Block or report user

Report or block mckernanin

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
@joshnuss
joshnuss / app.js
Last active Oct 21, 2019
Express.js role-based permissions middleware
View app.js
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@Lewiscowles1986
Lewiscowles1986 / lc-svg-upload.php
Last active Aug 4, 2016
SVG Media Plugin for WordPress (Works since 4.1.2!)
View lc-svg-upload.php
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@windyjonas
windyjonas / wordpress-escaping.md
Last active Jun 25, 2019
Most of the escaping functions in WordPress, with a short explanation and example.
View wordpress-escaping.md

WordPress escaping functions

By: Jonas Nordström, @windyjonas
Date: 2013-04-16

esc_attr( $text );
Encodes the <, >, &, " and ' (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Example:

<div class="<?php echo esc_attr( $my_class ); ?>"></div>
View csv-to-json.php
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
You can’t perform that action at this time.