Skip to content

Instantly share code, notes, and snippets.

View cappadona's full-sized avatar

Nick Cappadona cappadona

View GitHub Profile
@kujohn
kujohn / portforwarding.md
Last active April 3, 2025 15:00
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@jrochkind
jrochkind / gist:6715756
Created September 26, 2013 15:24
JH custom JS for blacklight_advanced_search to have differnet method of auto-complete multi-select for voluminous facets
/* Custom JS for Advanced Search Form */
jQuery(document).ready(function($) {
// A utility function we'll use to make a JQuery selector
// on a particular string 'id'. HTML id allows : or . chars,
// but need to be escaped in JQuery selectors.
// See http://docs.jquery.com/Frequently_Asked_Questions#How%5Fdo%5FI%5Fselect%5Fan%5Felement%5Fby%5Fan%5FID%5Fthat%5Fhas%5Fcharacters%5Fused%5Fin%5FCSS%5Fnotation.3F
function jq_id_select_escape(str_id) {
return str_id.replace(/(:|\.)/g,'\\$1');
@rbazinet
rbazinet / tinyurl.rb
Created June 6, 2013 12:10
Simple Ruby class to shorten URLs using TinyURL.
class Tinyurl
include HTTParty
base_uri 'tinyurl.com'
def shorten(url)
self.class.get("/api-create.php?url=#{url}")
end
end
@cfitz
cfitz / gist:5265810
Last active December 15, 2015 13:18
quick coffeescript example how to pull bookjacket covers from Google Books in Blacklight. In the views, I added a span with .bookcover and an id of the isbn. AJAX grabs all the .bookcover id's, queries google, which returns JSONP that have all the images url. eh. you don't have to use google...you could just make your own controller that returns…
insertBookCoverImage = (data) ->
for id, values of data
imgId = values.bib_key.toLowerCase().replace(":", "_")
$("##{imgId}").attr("src", values.thumbnail_url)
addBookCovers = (ids) ->
url = "http://books.google.com/books?bibkeys=#{ids}&jscmd=viewapi&callback=?"
$.getJSON url, {}, insertBookCoverImage
@tiffon
tiffon / Find Results.hidden-tmLanguage
Created December 19, 2012 01:17
Tricked-out Find in Files... results
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Find Results</string>
<key>patterns</key>
<array>
<dict>
@framallo
framallo / unicorn.rb
Created October 9, 2012 19:47
init upstart script for ubuntu 12.04 and Rails 3 app
app_dir = "/home/public_forums/unstable/"
worker_processes 5
pid "#{app_dir}/tmp/pids/unicorn.pid"
# listen "#{app_dir}/tmp/sockets/public_forum.socket"
listen 5000, :tcp_nopush => true
stderr_path "#{app_dir}/log/unicorn.stderr.log"
stdout_path "#{app_dir}/log/unicorn.stdout.log"
@linjunpop
linjunpop / README.md
Created August 21, 2012 01:15
Rails flash messages with AJAX requests
@vicentereig
vicentereig / httpd.conf
Created August 10, 2012 10:20
Apache 2 + Proxy Balancer + Thin + Rails Asset Pipeline Development Environment for MacOSX
# These modules should be loaded by default: proxy_module, proxy_balancer_module, rewrite_module
Listen *:80
# You may want to keep the VirtualHost config under extra/*.conf
# Start your thin
<VirtualHost *:80>
ServerName wwww.yourawesomeapp.dev
@diethardsteiner
diethardsteiner / index.html
Created August 7, 2012 17:52
Simple D3JS Dashboard
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<!--<script type="text/javascript" src="d3/d3.v2.js"></script>-->
<script src="http://d3js.org/d3.v2.js"></script>
<!-- Note: I made good use of the sample code provided by the D3JS community and extended it to fit my needs to create this simple dashboard -->
<style type="text/css">