Skip to content

Instantly share code, notes, and snippets.

View kylewest's full-sized avatar

Kyle West kylewest

View GitHub Profile
<!-- put this code in custom html <head> section (Website Configuration) -->
<script type="text/javascript">
$(document).ready(function(){
if ( /magnaflow/i.test($("h1").text()) ) {
$("#ctl00_MainContentPlaceHolder_YourPriceLabel").after("<br/>Use Coupon: MAGNAFLOW for an extra 5% off");
}
if ( /aeromotive/i.test($("h1").text()) ) {
$("#ctl00_MainContentPlaceHolder_YourPriceLabel").after("<br/>Use Coupon: AEROMOTIVE for an extra 5% off");
}
});
@adamwitko
adamwitko / iis.py
Last active August 23, 2016 09:16
Example Datadog IIS log line parser
import time
from datetime import datetime
def parse_iis(logger, line):
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
line_date, line_time, server_ip, cs_method, cs_uri_stem, cs_uri_query, server_port, cs_username, client_ip, cs_user_agent, cs_referer, status_code, sub_status, win32_status, time_taken = line.split()
dt = datetime.strptime(line_date+"T"+line_time, "%Y-%m-%dT%H:%M:%S")
dt = time.mktime(dt.timetuple())
@kylewest
kylewest / brands-dropdown.html
Last active February 14, 2017 03:15
brands-dropdown.html
<!-- Copy and paste this code to Configuration -> Website -> Custom HTML <head> -->
<script type="text/javascript">
$(document).ready(function(){
$('#brandlist ul').hide().parent().append('<select>'); $('#brandlist ul li').each(function(){ var link = $(this).find('a');
$('#brandlist select').append('<option value="'+link.attr('href')+'">'+link.html()+'</option>');
});
$('#brandlist select').on("change", function(){
window.location.href = $(this).val();
});
});
<script type="text/javascript">
$(document).ready(function(){
if ( /(clutch masters|name of other brand|name of 3rd brand)/i.test($("h1").text()) ) {
$("#ctl00_MainContentPlaceHolder_YourPriceLabel").after("<br/>Coupon Code: megancoilovers<br/>Discount: Extra 5% off");
}
});
</script>
@kylewest
kylewest / gist:1514301
Created December 23, 2011 14:07
replace all 3-character HEX color codes with 6-character codes in vim
# this will replace all 3-character HEX color codes with 6-character codes in vim.
%s/#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\@!/#\1\1\2\2\3\3/g
1--
2---------------------------------------------
3--------------
4----------------
5-
1. substitution.
@nicoulaj
nicoulaj / build-zsh.sh
Created November 25, 2010 20:19
Build Zsh from sources on Ubuntu
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://zsh.git.sf.net/gitroot/zsh/zsh
cd zsh