Skip to content

Instantly share code, notes, and snippets.

View mkober's full-sized avatar

Mark Koberlein mkober

View GitHub Profile
@mkober
mkober / router.php
Created December 2, 2017 17:49
Wordpress Router for PHP Built-in Web Server
<?php
// Extracted from the `wp-cli` project. https://wp-cli.org/
$root = $_SERVER['DOCUMENT_ROOT'];
$path = '/'. ltrim( parse_url( urldecode( $_SERVER['REQUEST_URI'] ) )['path'], '/' );
if ( file_exists( $root.$path ) ) {
// Enforces trailing slash, keeping links tidy in the admin
@mkober
mkober / server.js
Created January 6, 2020 04:48
Node.js Web Server and Watcher
const connect = require('connect');
const finalhandler = require('finalhandler');
const serveStatic = require('serve-static');
const path = require('path');
const winston = require('winston');
const sassMiddleware = require('node-sass-middleware')
const http = require('http');
const hound = require('hound')
const cpx = require("cpx");
@mkober
mkober / .profile
Created January 6, 2020 05:18
EC2 User Profile
# fin - command line TODO list
# https://medium.com/@sambrin/fin-command-line-todo-list-made-with-30a2346de068
# Notes
# 1. Original find didn't work properly on AWS
# find ${TASKS_DIR} -not -path '*/\.*' -type f -execdir echo '{}' ';' | nl -s '[] ' -b n
BOLD_AND_UNDERLINED="\e[1;4m"
GREEN="\e[32m"
STANDARD="\e[0m"
TODO_LIST_LABEL="\n — — — — — — — — — — — -TODO — — — — — — — — — — — — -\n"
@mkober
mkober / windows-symlinks.md
Last active February 11, 2024 16:42
Creating Symbolic Links on Windows
@mkober
mkober / wordpress-install.sh
Created January 25, 2021 03:45
Shell Script to Install WordPress on Repl.it
#!/bin/bash
# Source: https://repl.it/talk/learn/Installing-WordPress-on-Replit/34284
mkdir Work
cd Work
wget http://archive.ubuntu.com/ubuntu/pool/main/p/php7.2/php7.2-mysql_7.2.3-1ubuntu1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/p/php7.2/php7.2-sqlite3_7.2.3-1ubuntu1_amd64.deb
wget https://wordpress.org/latest.zip