Skip to content

Instantly share code, notes, and snippets.

Darren Terhune darrenterhune

Block or report user

Report or block darrenterhune

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@darrenterhune
darrenterhune / nokogiri.sh
Last active Aug 29, 2015
Nokogiri Mac OS X Mavericks
View nokogiri.sh
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
@darrenterhune
darrenterhune / finder.rb
Last active Aug 29, 2015
Find all users unless has_many matches a specific date
View finder.rb
User
has_many :bookings
| id | name |
---------------
| 1 | amy |
| 2 | jack |
@darrenterhune
darrenterhune / heartbleed.sh
Created Apr 9, 2014
openssl heartbleed update
View heartbleed.sh
# Update the system and packages
sudo apt-get update
sudo apt-get dist-upgrade
# Restart server
sudo shutdown -r now
# Check openssl is upgraded against versions below
dpkg -l | grep "openssl"
@darrenterhune
darrenterhune / search-widget.html
Last active Aug 29, 2015
ASAP Search Widget (NEW)
View search-widget.html
<!-- START aircraftsalesandparts.com widget -->
<style type="text/css" media="screen">
#asap.asap-widget{margin:20px 0;}#asap.asap-widget .title{background:#ddd;color:#666;text-shadow:1px 1px 0 #eee;top:-1px;border:1px solid #C2C2C2;padding:10px;margin:0;}#asap.asap-widget .link{padding:5px;background:#333;color:#eee;}#asap.asap-widget table{display:block;border:1px solid #D8D8D8;border-bottom:none;}#asap.asap-widget table tr{padding:5px;}#asap.asap-widget table th{text-align:left;padding:5px;color:#333;}#asap.asap-widget table td{padding:10px;}#asap.asap-widget table td.title{width:200px;font-weight:bold;color:#777;}#asap.asap-widget table form input.submit{margin-left:4px;}</style>
<div id="asap" class="asap-widget"><div class="recent-widget"><h3 class="title"><span>Find Aircraft Parts</span></h3><div class="items"><table><tr><td><form action="https://aircraftsalesandparts.com/parts/search" method="get" target="_blank"><input id="search" name="search" type="text" /><input type="hidden" name="submit" value="
@darrenterhune
darrenterhune / redis.sh
Last active Aug 29, 2015
Redis install
View redis.sh
# redis install
sudo apt-get install tcl8.5
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable/
make
make test
sudo make install
sudo mkdir /etc/redis
View textmate mate shell open snippet
# add this to your .bash_* to open projects in one fell swoop
function m {
if [ "$1" ]; then
cd ~/Sites; # (update directory root location to suit your needs)
mate $1
fi
}
@darrenterhune
darrenterhune / open app in textmate and start server
Created Oct 13, 2009
unix function to open app/boot rails
View open app in textmate and start server
function ss {
if [ "$1" ]; then
# cd to the rails app directory.
cd ~/Sites; # (update the repository root location to suit your needs)
if [ "$1" ]; then
mate $1
cd `ls|grep $1|sort|tail -1`
fi
echo $(pwd)
fi
View IE Fixes and Hacks
/*best clearfix around*/
.clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;}
.clearfix {display: inline-block;}
html[xmlns] .clearfix {display: block;}
* html .clearfix {height: 1%;}
/*transparent pngs... you will need a 1px X 1px transparent.gif on your web server, and may need to modify the url below*/
* html img,* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
@darrenterhune
darrenterhune / kernel-commands.sh
Last active Sep 4, 2015
helpful unix kernel commands
View kernel-commands.sh
# convert lines in text file
tr '[:lower:]' '[:upper:]' <oldfile> newfile
# download a gzip file from remote server
ssh server "gzip -c remote_file" > local_file.gz
# secure copy local file to remote server
scp localfile user@remote_server.com:remote_directory
# find all files that have been modified in the last 3 days
@darrenterhune
darrenterhune / move logic to model
Created Feb 24, 2010
csv import example in model
View move logic to model
# controller
def proc_csv
import = Import.find(params[:id])
if import.load_csv
flash[:notice] = "woo"
redirect_to some_url
else
flash[:error] = "ohoh"
end
end
You can’t perform that action at this time.