Skip to content

Instantly share code, notes, and snippets.

View jekkilekki's full-sized avatar

Aaron Snowberger jekkilekki

View GitHub Profile
@hofmannsven
hofmannsven / README.md
Last active April 19, 2024 13:17
Git CLI Cheatsheet
@paulund
paulund / example-wp-list-table.php
Last active March 31, 2024 05:40
An example code of using the WP_List_Table class. With Pagination.
<?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
*/
@joepie91
joepie91 / express-server-side-rendering.md
Last active February 20, 2024 20:52
Rendering pages server-side with Express (and Pug)

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
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
@justinph
justinph / validate_gravatar.php
Created March 19, 2013 16:49
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
/**
* 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 October 26, 2011 21:07 — forked from boogah/WP_Bag_of_Tricks.txt
Things I've learned by being DreamHost's resident WordPress nerd.
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/
@saas786
saas786 / sanitize_checkbox.php
Last active April 7, 2019 10:47
Sanitization of customizer controls
/*
* 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
@pat-eason
pat-eason / functions.php
Last active March 9, 2017 21:19
Split Menu structure for WordPress
<?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();