Skip to content

Instantly share code, notes, and snippets.

Aaron Snowberger jekkilekki

Block or report user

Report or block jekkilekki

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
@joepie91
joepie91 / express-server-side-rendering.md
Last active Dec 9, 2019
Rendering pages server-side with Express (and Pug)
View express-server-side-rendering.md

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
View nodejs setup on Dreamhost VPS
1) Make a download dir to store the node source and download it.
mkdir downloads
cd downloads
git clone https://github.com/joyent/node.git
Find the latest version
2) List all of the tags in the repository, and check out the most recent.
git tag
git checkout v0.9.9
@saas786
saas786 / sanitize_checkbox.php
Last active Apr 7, 2019
Sanitization of customizer controls
View sanitize_checkbox.php
/*
* Sanitize Checkbox
*/
// Source: https://github.com/FlagshipWP/flagship-library/blob/develop/customizer/classes/customizer-base.php
/**
* Sanitize a checkbox to only allow 0 or 1
*
* @since 1.2.0
* @access public
@CoastalP47
CoastalP47 / functions.php
Last active Mar 9, 2017
Split Menu structure for WordPress
View functions.php
<?php
/* ==========
Get Split Nav
include $menu_name for the menu you want and $raw=true if you want to return just the menu objects
========== */
function get_split_nav($menu_name=null, $raw=false){
if($menu_name == null || !is_string($menu_name)){
return false;
}
$output = new stdClass();
@paulund
paulund / example-wp-list-table.php
Last active Nov 17, 2019
An example code of using the WP_List_Table class. With Pagination.
View example-wp-list-table.php
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
View README.md
View custom-gallery-setting.js
@justinph
justinph / validate_gravatar.php
Created Mar 19, 2013
In wordpress, a better way to check if an author has a gravatar or not. Sometimes you might want to check to see if a gravatar exists and not display any image if there isn't one. Uses the wordpress HTTP and caching apis. A better version of this: http://codex.wordpress.org/Using_Gravatars#Checking_for_the_Existence_of_a_Gravatar
View validate_gravatar.php
/**
* Utility function to check if a gravatar exists for a given email or id
* @param int|string|object $id_or_email A user ID, email address, or comment object
* @return bool if the gravatar exists or not
*/
function validate_gravatar($id_or_email) {
//id or email code borrowed from wp-includes/pluggable.php
$email = '';
@getsource
getsource / WP_Bag_of_Tricks.txt
Created Oct 26, 2011 — forked from boogah/WP_Bag_of_Tricks.txt
Things I've learned by being DreamHost's resident WordPress nerd.
View WP_Bag_of_Tricks.txt
WP Bag of Tricks
1. Helpful Scripts/Plugins:
Hacks:
http://wordpress.org/extend/plugins/tac/
http://wordpress.org/extend/plugins/exploit-scanner/ (Can be extremely resource intensive.)
http://wordpress.org/extend/plugins/wp-malwatch/
You can’t perform that action at this time.