Skip to content

Instantly share code, notes, and snippets.

View ethernick's full-sized avatar

Nick Kempinski ethernick

View GitHub Profile
@ethernick
ethernick / wp_activitypub_conditional_shortcode
Last active June 4, 2024 21:59
Here's a little short code I use to add some conditional magic for federating content. Use case: If the post is short, just post the content - no title; no permalink.
<?php
function conditional_shortcode($atts, $content, $tag){
global $post;
$atts = shortcode_atts(
array( 'length' => 400, 'condition' => 'gt' ),
$atts,
$tag
);

Keybase proof

I hereby claim:

  • I am ethernick on github.
  • I am ethernick (https://keybase.io/ethernick) on keybase.
  • I have a public key whose fingerprint is E6A2 939B 1EA8 06FE 122B 6728 2742 2FC5 0E85 69D6

To claim this, I am signing this object:

@ethernick
ethernick / playlist.js
Last active August 29, 2015 14:18
Auido Aether Playlist
// Create a new database using an array
var playlist = [
{
url: "https://soundcloud.com/asthmatickitty/sufjan-stevens-should-have-known-better",
rotation: 20,
label: "new"
},
{
url: "https://soundcloud.com/bigdatabigdata/big-data-clean-feat-jamie-lidell",
rotation: 20,
@ethernick
ethernick / metamarkdown.php
Last active August 29, 2015 13:58
Extend PHP Fat-Free (F3) with MetaMarkdown. Setting a global 'meta' var that can be used later on.
<?php
class MetaMarkdown extends Markdown {
protected function meta($txt) {
$pattern = '/^([A-Za-z]+)\:\s*\t*(.+)$/m';
//$pattern = '/^(.*)\:(?\s*)(?\t*)(.+)(\r\n|\n)/';
//echo $txt;
$txt = preg_replace_callback(
'/^([A-Za-z]+)\:\s*\t*(.+)$/m',
function($expr) {