Skip to content

Instantly share code, notes, and snippets.

View abrudtkuhl's full-sized avatar
🥓

Andy Brudtkuhl abrudtkuhl

🥓
View GitHub Profile
@abrudtkuhl
abrudtkuhl / web.config
Created June 30, 2014 22:42
WordPress on IIS Web.config to use permalinks
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@abrudtkuhl
abrudtkuhl / CreatePost.cs
Last active August 18, 2018 08:58
Using WordPressSharp To Publish A Post
// create a new Post in WordPress
var post = new Post
{
PostType = "post", // "post" or "page"
Title = "Using WordPressSharp",
Content = "WordPressSharp is a C# utility for interfacing with the WordPress XML-RPC API",
PublishDateTime = DateTime.Now,
Status = "publish" // "draft" or "publish"
};
@abrudtkuhl
abrudtkuhl / Github OAuth ASP.Net MVC
Created June 26, 2012 14:34
Github OAuth callback for ASP.Net MVC. Set yourapp.com/github/callback as the OAuth callback URL when you setup your application. If the users chooses to grant you permission, this controller/action get called to complete the transaction. See http://devel
public class GithubController : Controller
{
/// <summary>
/// Github OAuth Callback
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public JsonResult callback(string code)
{
var clientId = "[insert yours]";
@abrudtkuhl
abrudtkuhl / wordpress.gitignore
Created July 30, 2014 17:50
.gitignore file for WordPress
# This is a template .gitignore file for git-managed WordPress projects.
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
# content. Or see git's documentation for more info on .gitignore files:
@abrudtkuhl
abrudtkuhl / index.html
Last active March 6, 2018 07:14
Simple KnockoutJS paging with DataTables
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple KnockoutJS Paging With DataTables.net</title>
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
@abrudtkuhl
abrudtkuhl / single-{category}.php
Created September 25, 2015 15:50
WordPress Single Page Template For Categories
<?php
// CATEGORY SINGLE TEMPLATES :: single-{category_slug}.php
add_filter( 'single_template',
create_function( '$t', 'foreach( (array) get_the_category() as $cat ) {
if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php";
} return $t;' ) );
// Example
@abrudtkuhl
abrudtkuhl / kramerbot.js
Last active March 24, 2016 19:32
Node.js class for a Slack bot using the WordPress REST API
/* code inspired by Luciano Mammino via http://bit.ly/1KoCOjM */
'use strict';
var util = require('util');
var path = require('path');
var Bot = require('slackbots');
var WP = require( 'wordpress-rest-api' );
/**
@abrudtkuhl
abrudtkuhl / kramerbot.js
Created March 19, 2016 19:27
Basic Slack Bot Node.js
'use strict';
var messages = [
'Giddyup',
'Isosceles. You know, I love the name Isosceles. If I had a kid, I would name him Isosceles. Isosceles Kramer.',
'You know what you are? You’re an anti-dentite! It starts with a few jokes and slurs… ‘HEY DENTY!’ Then you will say that dentists should have their own schools!',
'Have you ever met a proctologist? They usually have a very good sense of humor. You meet a proctologist at a party, don’t walk away. Plant yourself there because you will hear the funniest stories you’ve ever heard.',
'What do you think Junior? You think these hands – they’ve been soaking in Ivory Liquid?',
'http://i.giphy.com/aMh59aKR8vjdC.gif'
];
@abrudtkuhl
abrudtkuhl / plugin.php
Last active March 11, 2016 22:09
Extending the WordPress REST API to return message to Slack
<?php
/**
* Plugin Name: WP Slack Slash Command Example
* Description: An example of using the WordPress REST API as a backend for a Slack Slash Command
* Author: Andy Brudtkuhl
* Author URI: http://youmetandy.com
* Version: 0.1
* Plugin URI: https://github.com/abrudtkuhl/wp-slack-slash-command
* License: GPL2+
<?php
/*
Plugin Name: Posterous Importer
Plugin URI: http://wordpress.org/extend/plugins/posterous-importer/
Description: Import posts, comments, tags, and attachments from a Posterous.com blog.
Author: Automattic, Brian Colinger, Peter Westwood, Daryl L. L. Houston
Author URI: http://automattic.com/
Version: 0.10
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/