Skip to content

Instantly share code, notes, and snippets.

View virtualstaticvoid's full-sized avatar

Chris Stefano virtualstaticvoid

View GitHub Profile
@virtualstaticvoid
virtualstaticvoid / setup.sh
Created August 23, 2011 07:52
Ubuntu install UFW (Uncomplicated Firewall)
#!/bin/bash
sudo apt-get install ufw
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow http
@virtualstaticvoid
virtualstaticvoid / gist:1164584
Created August 23, 2011 07:41
Ubuntu set correct timezone
sudo dpkg-reconfigure tzdata
@virtualstaticvoid
virtualstaticvoid / .gitconfig
Created August 16, 2011 09:44
Git commands for maintaining a master, development and feature branches
[branch "master"]
mergeoptions = --no-ff --no-commit
[branch "development"]
mergeoptions = --ff-only
@virtualstaticvoid
virtualstaticvoid / pagination.md
Created August 10, 2011 15:28 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@virtualstaticvoid
virtualstaticvoid / jqgrid_restful_support.js
Created August 5, 2011 18:05
Rails RESTful jQuery jqGrid integration
/* from http://tjhanley.com/wp/2009/04/30/rails-restful-jquery-jqgrid-integration/ */
jQuery("#badata").click(function(){ 
jQuery("#<%= dom_id(@live_community_builder) %>").editGridRow("new",
{mtype:'POST',
closeAfterAdd:true,
height:280, width:600,
reloadAfterSubmit:true,
url:'<%= widget_context_mappings_path(@live_community_builder.widget) %>'});
});
@virtualstaticvoid
virtualstaticvoid / make_dev_ssl_cert
Last active September 26, 2015 05:47
Make self-signed SSL certificate for development
#!/bin/bash
# as per http://www.24hourapps.com/2009/02/generate-your-own-free-ssl-certificate.html
# will prompt for passwords and details for certificate creation
# change file name as required
filename=${1:-mycert}
openssl genrsa -des3 -out $filename.key 1024
openssl req -new -key $filename.key -out $filename.csr
@virtualstaticvoid
virtualstaticvoid / iptables_rules.sh
Created June 14, 2011 08:58
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@virtualstaticvoid
virtualstaticvoid / .irbrc
Created June 8, 2011 13:21 — forked from wtnabe/.irbrc
A model dumper for rails console ( Rails 3 or later ) and .irbrc for rails env
# -*- mode: ruby; coding: utf-8 -*-
if defined? Rails
railsrc = __FILE__ + '.rails'
load railsrc if File.exist? railsrc
envrc = File.join( Rails.root, '.irbrc' )
load envrc if File.exist? envrc
end
# http://rubypond.com/blog/useful-flash-messages-in-rails
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
def flash_messages
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
formatted_messages = messages.map do |type|
content_tag :div, :class => type.to_s do
message_for_item(flash[type], flash["#{type}_item".to_sym])
end
#!/bin/bash
# ***************************************************************
# Name: install_chef_client.sh
# Purpose: Install chef client and register with the chef
# server.
# Notes: This script must be run as root
# This script installs the chef repo in the /root home
# directory
# Assumes these files exist in the same directory:
# <-c input>.pem