Skip to content

Instantly share code, notes, and snippets.

View bmcminn's full-sized avatar

Brandtley McMinn bmcminn

View GitHub Profile
@bmcminn
bmcminn / post_class_filter.php
Created April 30, 2012 10:47
PHP: post_class() filter - add custom post classes
<?php
// Practically verbatim from the WordPress codex
// http://codex.wordpress.org/Function_Reference/post_class#Add_Classes_By_Filters
add_filter('post_class','MYTHEME_post_class_cats');
function MYTHEME_post_class_cats($classes) {
global $post;
@bmcminn
bmcminn / JS Cookies Snippet
Created December 3, 2012 06:20
JS: Cookie management
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
@bmcminn
bmcminn / greasestarter.user.js
Last active December 21, 2022 22:01
JS: A simple boilerplate Grease/Tampermonkey script. This starter script aliases a custom jQuery instance on the page so you can start doing some fancy dom manipulation stuffs with absolutely no consequences.
// ==UserScript==
// @name SCRIPT_NAME_HERE
// @namespace NAMESPACE
// @version 0.1
// @description WIDGET_DESCRIPTION_HERE
// @match http*://*/*
// @include http*://*/*
// @copyright 2013+, YOURNAME
// ==/UserScript==
@bmcminn
bmcminn / clist-filter.user.js
Last active December 19, 2015 05:19
JS: Userscript that adds a persistent REGEX filter field to craigslist search pages.
// ==UserScript==
// @name CList Filter
// @version 0.2
// @namespace giggleboxstudios
// @include *.craigslist.org/search/*
// @grant none
// ==/UserScript==
/*jshint strict:true, evil:true, boss:false, laxcomma:true, laxbreak:true, latedef:true, immed:true, newcap:true, noarg:true, nonew:true, plusplus:true, regexp:true, undef:true, unused:true, trailing:true, eqeqeq:true, curly:true, camelcase:true, bitwise:true */
@bmcminn
bmcminn / PHP: bootstrap-modules.php
Created July 8, 2013 11:55
Simple PHP functions to generate Twitter bootstrap components
<?php
/**
* Generates a Twitter Bootstrap menu markup, complete with Dropdown menus as defined in sitedata.json
* @param array $data JSON data converted to PHP array in siteconfig.php
* @param boolean $settings Overrideable settings array to provide some options
*/
function add_menu($data, $settings = false) {
@bmcminn
bmcminn / cURL.php
Last active December 25, 2015 20:39 — forked from dfreerksen/Curl.php
<?php
class cURL {
/**
* cURL request method
*
* @var string
*/
protected $_method = 'GET';
@bmcminn
bmcminn / BASH: node-webkit.bash
Last active December 30, 2015 08:19
A bunch of helper functions and short hand methods that I find useful in developing Node-Webkit applications.
#!/bin/sh
#
#
# _____ _ _ _ _ _ _ _ _
# | | |___ _| |___ ___| | | |___| |_| |_|_| |_
# | | | | . | . | -_|___| | | | -_| . | '_| | _|
# |_|___|___|___|___| |_____|___|___|_,_|_|_|
#
# _____ _ _____ _
# | __ |___ ___| |_ | | |___| |___ ___ ___ ___
@bmcminn
bmcminn / README.md
Last active May 27, 2020 21:05
Bookmarklets
@bmcminn
bmcminn / sample.cpp
Last active August 29, 2015 14:09
Gist Source Samples
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
std::cin.get();
return 0;
}
@bmcminn
bmcminn / String.stripMoneyFormat.js
Created August 18, 2015 21:49
My custom String object methods
function stripMoneyFormat(string, currency) {
currency = currency || '$';
var regex = {
moneys: new RegExp('[\\'+currency+'\,]', 'g')
}
;
if (typeof(string) == "string") {
return parseFloat(string.replace(regex.moneys, ''))toFixed(2);