Skip to content

Instantly share code, notes, and snippets.

Avatar
💤

Shea Bunge sheabunge

💤
View GitHub Profile
@sheabunge
sheabunge / wp-loop.php
Last active Mar 18, 2020
WordPress loop generator function, as described at https://wpscholar.com/blog/creating-better-wordpress-loop/
View wp-loop.php
<?php
/**
* Simplifies the WordPress loop.
*
* @param WP_Query|WP_Post[] $iterable
*
* @return Generator
*/
function wp_loop( $iterable = null ) {
@sheabunge
sheabunge / flashget.sh
Created Sep 29, 2016
Shell script for retrieving flash videos from Linux cache. Tested on Ubuntu.
View flashget.sh
#!/usr/bin/env bash
pids=$(ps ax | grep -iE 'chrome|firefox|vivaldi' | grep -i flash | awk '{ print $1 }')
for pid in $pids
do
file -L /proc/$pid/fd/* | grep -iE 'video|media|mp4|flash' | cut -f 1 -d ':'
done
@sheabunge
sheabunge / flashget
Last active Mar 19, 2016
Bash script for retrieving flash videos from Firefox/Chrome cache
View flashget
#!/usr/bin/env bash
for process in chrome firefox
do
pid=$(ps ax | grep -i $process | grep -i flash | cut -f 1 -d ' ')
file -L /proc/$pid/fd/* | grep -iE 'video|media|mp4|flash' | cut -f 1 -d ':'
done
@sheabunge
sheabunge / Getting Started with Drupal and Drush.md
Last active Jan 25, 2016
Getting Started with Drupal and Drush
View Getting Started with Drupal and Drush.md

Getting Started with Drupal and Drush

As part of participating in Google Code-In this year, I am introducing myself to Drupal, as an excersise to see how it works and what it offers as an alternative to WordPress for building content managed websites. As part of this process, I am learning how to install Drupal on an Ubuntu-powered web server running nginx and PHP 7.

To make installing and managing Drupal much easier, we will be shell interface for Drupal known as Drush. Drush is an incredibly useful tool, allowing you to perform a number of various tasks from the command line as a faster and more efficient alternative to using the graphical web based administration.

Setting up the server

First step is to install a web server for Drupal to run on. The first component of this is nginx, a fast and effecient server which can integrate with PHP. It is avaliable in the default Ubuntu repostories and can be installed like so:

sudo apt install nginx
@sheabunge
sheabunge / autoload.php
Last active Nov 22, 2021
Basic PHP class autoloader that follows the WordPress coding standards for class names and class filenames
View autoload.php
<?php
namespace Shea\Example_Plugin;
/**
* Enable autoloading of plugin classes in namespace
* @param $class_name
*/
function autoload( $class_name ) {
@sheabunge
sheabunge / gist:de7e69eb6d81ad804b26
Last active Aug 29, 2015
Not eXactly C line following code
View gist:de7e69eb6d81ad804b26
/******************** Line Follow ********************/
task LineFollow()
{
OnFwd(L_MOTOR, POWER);
while(true)
{
if(SENSOR_A_BLACK)
{
if(SENSOR_B_WHITE)
View dl-file.php
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@sheabunge
sheabunge / feedly.css
Created Feb 23, 2014
Tweaks for Feedly on smaller screens. Use with something like Stylish.
View feedly.css
body.home {
top: 0 !important;
margin: 0 auto;
max-width: 100%;
}
#feedlyTabs {
padding-right: 55px !important;
padding-left: 10px !important;
max-width: 200px;
@sheabunge
sheabunge / hello-world.ahk
Created Jan 26, 2014
"Hello World" in different programming languages
View hello-world.ahk
MsgBox Hello World!
View conemu.py
import sublime, sublime_plugin, os, subprocess
class ConemuCommand(sublime_plugin.TextCommand):
def run(self, edit):
if os.name == "nt":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
process = subprocess.Popen(('c:/Program Files (x86)/ConEmu/ConEmu.exe', '/single', self.view.file_name()),