Skip to content

Instantly share code, notes, and snippets.

@robflaherty
robflaherty / nginx-0765-installer.txt
Created February 19, 2010 00:39
Nginx 0.7.65 installer for Webfaction
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/bin/env python2.4
"""
Nginx 0.7.65 Installer New
"autostart": not applicable
"extra info": Enter domain name for the nginx app
"""
@robflaherty
robflaherty / gaEventTracking.js
Created February 28, 2010 22:28
Simple Google Analytics event tracking. Tracks external links, downloads, and mailtos
document.onclick = function(event) {
event = event || window.event;
var target = event.target || event.srcElement,
targetElement = target.tagName.toLowerCase();
if (targetElement == "a") {
var href = target.getAttribute("href"),
urlHost = document.domain.replace(/^www\./i,"");
var urlPattern = "^(?:https?:)?\/\/(?:(?:www)\.)?" + urlHost + "\/?";
/*
* Inspired by (directly copied from) Mathias Bynens' optimized Google Analytics snippet
* http://mathiasbynens.be/notes/async-analytics-snippet
* Not fully tested, use at own risk!
*/
<script>
var clicky = { log: function(){ return; }, goal: function(){ return; }},
clicky_site_id = XXXXXX;
(function(d, t) {
javascript:(function(){var a=window.open("about:blank").document;a.write("<!DOCTYPE html><html><head><title>Source of "+location.href+'</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');a.close();var b=a.body.appendChild(a.createElement("pre"));b.style.overflow="auto";b.style.whiteSpace="pre-wrap";b.appendChild(a.createTextNode(document.documentElement.innerHTML))})();
/*
* Bookmarklet for viewing source in iPad Safari
*/
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');
s.close();
@robflaherty
robflaherty / fbLikeButton.html
Created June 8, 2010 17:39
Dynamic URL Facebook Like Button
<!-- Like button placeholder -->
<div id="fbLikeBtn"></div>
<!-- Like button script -->
<script>
$(function(){
var fbUrl = encodeURIComponent(location.href),
fbIframe = '<iframe src="http://www.facebook.com/plugins/like.php?href=' + fbUrl + '&amp;layout=standard&amp;show_faces=false&amp;width=300&amp;action=recommend&amp;font=arial&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:35px;" allowTransparency="true"></iframe>';
$("#fbLikeBtn").html(fbIframe);
@robflaherty
robflaherty / gist:567525
Created September 6, 2010 21:17
Script for rotating nginx logs
#!/usr/bin/evn python2.6
# Shell script for rotating/archiving nginx logs
import os
from datetime import datetime
cwd = os.getcwd()
date = datetime.now().strftime("%Y-%m-%d")
#!/bin/bash
curl -k --user USERNAME:PASSWORD -o delicious.xml -O 'https://api.del.icio.us/v1/posts/all'
@robflaherty
robflaherty / cookie.js
Created January 29, 2011 23:13
standalone utility for getting/setting/deleting cookies
//Set initial slide
changeSlide(currentSlide);
//Add this line to make the slides auto-change
autoSlide = setInterval(function() { nextSlide() }, 30000);