Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / enable.sh
Created March 1, 2014 02:04
Enable a new site on apache2
# enable the site
a2ensite example.com
# restart apache2
service apache2 reload
@bmcculley
bmcculley / style.css
Created March 13, 2014 17:44
WordPress Twenty Ten Theme with hoizontal menu css
/*
Theme Name: Twenty Ten Horizontal Subnav
Theme URI: http://blog.mzx.mobi/adding-horizontal-subnav-to-the-twenty-ten-theme.html
Description: The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the "Asides" and "Gallery" categories, and has an optional one-column page template that removes the sidebar.
Author: the WordPress team, modified by bmcculley
Author URI: http://mzx.mobi
Version: 0.1
Tags: black, blue, white, two-columns, fixed-layout, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style
Template: twentyten
*/
@bmcculley
bmcculley / search-and-replace.sh
Created March 25, 2014 04:26
Search and replace a word throughout a directory.
find ./ -type f -exec sed -i 's/apple/orange/g' {} \;
@bmcculley
bmcculley / gist:cefd138f918f669e4fce
Created May 10, 2014 01:59
Remove php extension htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
@bmcculley
bmcculley / shrink-a-dink.css
Created June 5, 2014 07:35
Decrease the height of the navbar bootstrap 3.0
.navbar-brand,
.navbar-nav > li > a {
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.navbar {
min-height: 30px !important;
}
@bmcculley
bmcculley / cssmin.py
Last active August 29, 2015 14:07
A simple script to minify (multiple) CSS files.
import sys, re
css = ""
saveFileName = "default.css"
flag = False;
for n, i in enumerate(sys.argv):
if n == 0:
pass
elif i == "-h":
print "Add CSS files space seperated to be combined and minified. Add -s followed by the name of the new CSS file."
/* jsmin.c
2011-09-30
Copyright (c) 2002 Douglas Crockford (www.crockford.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
# This module is a JSMinimizer
# It will take any file and strip away all
# comments, and whitespace characters.
# This has only been tested for JS scripts,
# all other file types have not been verified
# to work as expected.
# Author: MikeWest
# Needs to be updated so that spaces that need to exist aren't stripped away
# This will require the recognition of which tokens need to be separated from
@bmcculley
bmcculley / gist:ff66594523512bbbec06
Created October 6, 2014 03:01
Remove duplicate rows from table
DELETE FROM `table`
WHERE id IN (SELECT *
FROM (SELECT id FROM `table`
GROUP BY column HAVING (COUNT(*) > 1)
) AS A
);
@bmcculley
bmcculley / testCurl.php
Last active August 29, 2015 14:07
Test if a server has curl on it or not
<?php
function _isCurl() {
return function_exists('curl_version');
}
if ( _isCurl() ) {
echo 'cURL is installed on this server :-)';
} else {
echo 'You\'ll need cURL for this...';