Skip to content

Instantly share code, notes, and snippets.

View stemwinder's full-sized avatar

Joshua Smith stemwinder

View GitHub Profile
<Directory /var/www/vhosts/b12vitaminsources.com/httpdocs>
php_admin_flag safe_mode off
php_admin_value open_basedir none
Options FollowSymLinks
</Directory>
@stemwinder
stemwinder / gist:3121075
Created July 16, 2012 06:22
Benchmark a bash script
sudo strace -o trace.log -c -Ttt ./script.sh
@stemwinder
stemwinder / states.html
Created December 4, 2012 16:58 — forked from eyeseast/states.html
For those times you need a state <select>
<option value="">State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
@stemwinder
stemwinder / print-names.sh
Created February 13, 2013 20:38
Print all filenames in current directory
printf "%s\n" *
@stemwinder
stemwinder / flatten-PDF.js
Created February 15, 2013 18:20
Flattens input fields and layers of PDF in Acrobat Pro
this.flattenPages();
@stemwinder
stemwinder / recursive_rm.sh
Last active December 15, 2015 11:48
Recursively removes files from bash shell
find . -name '.DS_Store' -print0 | xargs -0 rm
find . -name ".DS_Store" -depth -exec rm {} \;
@stemwinder
stemwinder / states_select_helper.php
Created April 10, 2013 18:25
Generates select dropdown HTML for US states
<?php
/**
* Generates select dropdown HTML for US states
* Optionally sets preselected state based on standard abbreviation
*
* @param string $selected
* @return string
* @author Joshua Smith
*/
<select name="time" id="time">
<option value="5:00 AM">5:00 AM</option>
<option value="5:15 AM">5:15 AM</option>
<option value="5:30 AM">5:30 AM</option>
<option value="5:45 AM">5:45 AM</option>
<option value="6:00 AM">6:00 AM</option>
<option value="6:15 AM">6:15 AM</option>
<option value="6:30 AM">6:30 AM</option>
<option value="6:45 AM">6:45 AM</option>
@stemwinder
stemwinder / Perl Find & Replace
Last active December 17, 2015 01:18
find and replace text in files from linux command line
perl -p -i -e 's/<oldword>/<newword>/g' *
@stemwinder
stemwinder / xfdf.php
Created August 16, 2013 15:25 — forked from collegeman/xfdf.php
Converts array to xFDF XML format
<?php
/*
KOIVI HTML Form to FDF Parser for PHP (C) 2004 Justin Koivisto
Version 1.1
Last Modified: 2010-02-17
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.