Skip to content

Instantly share code, notes, and snippets.

View corenominal's full-sized avatar

Philip Newborough corenominal

View GitHub Profile
@corenominal
corenominal / cylon_pumpkin.ino
Created November 5, 2014 18:21
Simple Arduino code for my little green pumpkin
// Internal LEDs
int blue1 = 12;
int blue2 = 13;
// Eye LEDs
int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int led5 = 6;
@corenominal
corenominal / humans.txt
Created December 11, 2015 19:16
The humans.txt file that I am using on my site.
# humanstxt.org/
# The humans responsible & technology colophon
# TEAM
_ _
___ ___ _ __ ___ _ __ ___ _ __ ___ (_)_ __ __ _| |
/ __/ _ \| '__/ _ \ '_ \ / _ \| '_ ` _ \| | '_ \ / _` | |
| (_| (_) | | | __/ | | | (_) | | | | | | | | | | (_| | |
\___\___/|_| \___|_| |_|\___/|_| |_| |_|_|_| |_|\__,_|_|
@corenominal
corenominal / oops.php
Created December 11, 2015 20:28
A default gist for my WP shortcode
<?php
/**
* Doh!
*/
die('This is not the gist you are looking for!');
@corenominal
corenominal / camd.sh
Created December 12, 2015 09:20
A time-lapse shell script for the Raspberry Pi
#!/bin/bash
# To mount drives, add to fstab, e.g.
# ===================================
# UUID=5b4b881f-8d88-4faf-9e76-6bbed8e92002 /home/user/data-one ext2 auto 0 0
# UUID=46910aac-a24e-422a-b871-74e0cbf4850c /home/user/data-two ext2 auto 0 0
# Crontab entries
# ===============
# * * * * * /home/user/bin/camd.sh
@corenominal
corenominal / theme-activation.php
Created December 12, 2015 12:47
A WP theme activation function to disable WordPress smilies
<?php
/**
* Theme activation/setup functions
* Notes:
* - after_switch_theme is triggered on the request immediately following a theme switch.
* - switch_theme is triggered when the blog's theme is changed. Specifically, it fires after the theme has been switched but before the next request. Theme developers should use this hook to do things when their theme is deactivated.
*/
function corenominal_set_theme_options()
{
@corenominal
corenominal / disable-wp-emoji.php
Created December 12, 2015 13:01
Functions to disable all WordPress emoji. No more smiling faces :)
<?php
/**
* Kill all emojis
* ===============
* See: http://wordpress.stackexchange.com/a/185578
*/
function disable_emojis()
{
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

foo logo #01

An animated HTML5 canvas logo. I was toying with the idea of using this for a project, but opted against it.

A Pen by Philip Newborough on CodePen.

License.

foo logo #02

An animated HTML5 canvas logo. I was toying with the idea of using this for a project, but opted against it.

A Pen by Philip Newborough on CodePen.

License.

@corenominal
corenominal / fix_allcustomposts_pagination.php
Last active January 6, 2016 19:30
A WordPress function to fix pagination when combining custom post types in a single loop.
<?php
/**
* WordPress function to fix pagination when combining custom post types in a single loop.
*/
function fix_allcustomposts_pagination($qs)
{
if( !isset( $qs['post_type'] ) && isset($qs['paged']) )
{
$qs['post_type'] = get_post_types($args = array(
'public' => true,
@corenominal
corenominal / custom_loop.php
Created January 6, 2016 19:40
An example WordPress custom loop to show all custom post types.
<?php
// Set-up the loop with all custom post types
$post_types = array( 'post', 'link', 'snippet', 'doodle' );
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => $post_types,
'paged' => $paged,
'posts_per_page' => 10
);
query_posts( $args );