Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@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 / proxy.php
Created March 14, 2014 03:02
An example proxy.php to get usgs.gov earthquake for use with jquake.
<?php
/**
* A proxy to get usgs.gov earthquake for use with jquake
* https://github.com/bmcculley/jquake
*
*/
$data = file_get_contents('http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson');
echo $data;
@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 / gist:d30f38b9e379d948b20c
Created September 3, 2014 05:26
Get the time in n hours from current time
#!/usr/bin/python
from datetime import datetime, timedelta
def timeFormatted(hoursNum):
ftime = datetime.now() + timedelta(hours=hoursNum)
return '{:%H:%M:%S}'.format(ftime)
# print the time eight hours from now
print timeFormatted(8)
@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
);