Skip to content

Instantly share code, notes, and snippets.

View abrudtkuhl's full-sized avatar
🥓

Andy Brudtkuhl abrudtkuhl

🥓
View GitHub Profile
@abrudtkuhl
abrudtkuhl / plugin.php
Created March 21, 2016 20:38
WordPress REST API - Get Random Post endpoint
<?php
/**
* Plugin Name: WP Slack REST API Backend
* Description: An example of using the WordPress REST API as a backend for a Slack Bot
* Author: Andy Brudtkuhl
* Author URI: http://youmetandy.com
* Version: 0.1
* Plugin URI: https://github.com/abrudtkuhl/heykramer
* License: GPL2+
@abrudtkuhl
abrudtkuhl / LogspotDriver.php
Created January 11, 2023 23:36
Logspot Log Driver For Laravel
<?php
namespace App\Logging;
use Illuminate\Log\Events\MessageLogged;
use Monolog\Logger;
use Logspot\Client;
class LogspotDriver
{
@abrudtkuhl
abrudtkuhl / tracking.js
Created October 31, 2017 17:06
Basic gtag.js Event Tracking Example
document.getElementById('search-submit').onclick = function() {
gtag('event', 'homepage_search', {
'event_category': 'Search',
'event_action': 'submit',
'event_label': 'Homepage Search'
});
};
@abrudtkuhl
abrudtkuhl / responsive-facebook-comments.css
Created August 8, 2012 18:01
Responsive Facebook Comments CSS
/* facebook comments */
.fb-comments, .fb-comments iframe[style], .fb-like-box, .fb-like-box iframe[style] {width: 100% !important;}
.fb-comments span, .fb-comments iframe span[style], .fb-like-box span, .fb-like-box iframe span[style] {width: 100% !important;}
@abrudtkuhl
abrudtkuhl / deploy.sh
Created March 4, 2021 13:54 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd /home/forge/domain.com
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin master
@abrudtkuhl
abrudtkuhl / nginx.conf
Created July 19, 2014 15:47
NGINX Proxy Config for Elasticsearch Readonly
# This config is based @karmi's answer on this Stackoverflow post: http://stackoverflow.com/a/14120342/12442
#
# Run me with:
#
# $ nginx -c path/to/this/file
#
# All requests except GET are denied.
worker_processes 1;
pid nginx.pid;
@abrudtkuhl
abrudtkuhl / kramerbot.js
Created March 21, 2016 20:53
Slack bot in Node.js grabbing data from a WordPress REST API backend.
'use strict';
var WP = require( 'wordpress-rest-api' );
var wp = new WP({ endpoint: 'http://local.dev/wp-json/' });
var Bot = require('slackbots');
var settings = {
token: XXXX,
name: 'kramerbot'
};
@abrudtkuhl
abrudtkuhl / admin_filter_by_custom_fields.php
Created July 22, 2014 20:13
WordPress Filter Posts By Custom Field Value In Admin
<?php
/*
Plugin Name: Admin Filter BY Custom Fields
Plugin URI: http://en.bainternet.info
Description: Filter posts or pages in admin by custom fields (post meta)
Version: 1.0
Author: Bainternet
Author URI: http://en.bainternet.info
*/
@abrudtkuhl
abrudtkuhl / nginx-elasticsearch-proxy.conf
Last active August 23, 2019 01:33 — forked from karmi/nginx-elasticsearch-proxy.conf
NGINX Reverse Proxy Authentication For Elasticsearch
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost/_search?q=*
#
# is rewritten to:
#
@abrudtkuhl
abrudtkuhl / wp_posts.reset.sql
Created July 22, 2014 17:54
Reset Auto_Increment in WordPress Posts table
DELETE FROM wp_posts;
DELETE FROM wp_post_meta;
TRUNCATE TABLE wp_posts;
TRUNCATE TABLE wp_post_meta;