Skip to content

Instantly share code, notes, and snippets.

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@jalberto
jalberto / list_bootstrap.rb
Created April 16, 2012 22:33
simple-navigation render for twiter bootstrap nav-list
class ListBootstrap < SimpleNavigation::Renderer::Base
def render(item_container)
list = item_container.items.inject([]) do |list, item|
if item.html_options[:opts]
if item.html_options[:opts][:nav_header]
list << li_header(item)
elsif item.html_options[:opts][:icon]
list << li_icon(item)
end
else
@fredrick
fredrick / README.md
Created November 22, 2011 18:17
Graylog2 Upstart Jobs

#Graylog2 Upstart

A basic set of Upstart jobs to get Graylog2 up and running quickly. Assumes MongoDB and Graylog2 installed in /opt/. Tested on Ubuntu Server 10.04 LTS, MongoDB 2.0.0, graylog2-server-0.9.5p1, and graylog2-web-interface-0.9.5p2.

#Usage

Place job definitions in /etc/init/ and then use service [job] [command] to start/stop/restart/status the services manually. On boot, the services flow into each other, only starting if dependent services have started. For more on controlling jobs or Upstart in general (a replacement for System-V init), see the cookbook.

#Author

@lucasmazza
lucasmazza / script.md
Created August 17, 2011 17:49
Redis 2.2 Install on Ubuntu 10.04

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
$ tar xvfz redis-2.2.2.tar.gz 
$ cd redis-2.2.2/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis