Skip to content

Instantly share code, notes, and snippets.

View postpostmodern's full-sized avatar

Jason T Johnson postpostmodern

View GitHub Profile
@postpostmodern
postpostmodern / width_classes.js
Created January 12, 2012 21:59
Add classes to <html> for responsive layouts
// Add classes to <html> for responsive layouts -
// e.g. <html class="over320 over480 under768 under960">
jQuery(function() {
var widths = [ 320, 480, 768, 960 ];
var setWidthClasses = function() {
var w = $(window).width();
for(var i=0; i<widths.length; i++) {
$('html').removeClass('under' + widths[i]).removeClass('over' + widths[i]);
}
@postpostmodern
postpostmodern / post.rb
Created January 8, 2012 23:37
posts scoped by subdomain
class PostsController < ApplicationController
inherit_resources
protected
def begin_of_association_chain
Agency.find_by_code request.subdomains.first
end
end
@postpostmodern
postpostmodern / gist:1343748
Created November 6, 2011 23:03
Pow Aliases
# Pow
alias startpow='curl get.pow.cx | sh'
alias stoppow='curl get.pow.cx/uninstall.sh | sh'
// IE doesn't deal well with button elements.
// The following jQuery code fixes the two most common issues:
// 1. All button values being submitted whether they were clicked or not
// 2. Button labels being submitted instead of the value of the value attribute
// Make sure you have loaded jQuery, of course.
if ($.browser.msie) {
jQuery(function() {
$('form button[type=submit]').click(function() {
// Handle on the button clicked
@postpostmodern
postpostmodern / 404.html
Last active February 20, 2022 01:34
My custom configurations for apache 2.2
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Not Found</title>
<style type="text/css" media="screen">
body {
background: #f0f0f0;
font: normal 18px sans-serif;
width: 400px;
#!/bin/bash
cd "/Users/_YOU_/Library/Application Support/Notational Data/"
# Make sure you've already set up the git repo
git add .
git commit -a -m "Simplenote Sync"
# Get SimplenoteSync here: http://fletcherpenney.net/other_projects/simplenotesync/
%body{:class => "#{controller_name} #{action_name}"}
<body class="<%= controller_name -%> <%= action_name -%>">
#!/usr/local/bin/ruby
require 'fileutils'
unless ARGV.size > 1
puts "Usage: #{__FILE__} [email protected] email [ email ] ..."
exit
end
QMAIL_DIR = "/var/qmail/mailnames"
alias_address = ARGV.shift
domain = alias_address.match(/[^@]+$/).to_s
@postpostmodern
postpostmodern / fixns.rb
Created February 5, 2009 17:02
Fixes NS records that incorrectly list slicehost.com instead of slicehost.net as the nameserver
#!/usr/bin/env ruby
# This should fix your NS records if you used the old version of slicedns.rb.
# Check to see if any of your zones list ns1/2/3.slicehost.com as a nameserver.
# It will change ALL NS records that have ns*.slicehost.com to ns*.slicehost.net
require 'rubygems'
require 'activeresource'
API_PASSWORD = 'your_api_key'