This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# seen on ap 11:22:33:44:55:66 with rssi 24 at Tue Mar 26 11:50:31.836 UTC 2013 | |
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
if ARGV.size < 2 | |
# The sinatra gem parses the -o and -p options for us. | |
puts "usage: sample_push_api_server.rb [-o <addr>] [-p <port>] <secret> <validator>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html | |
# https://www.varnish-cache.org/trac/wiki/VCLExamples | |
# Summary | |
# 1. Varnish will poll the backend at /health_check to make sure it is | |
# healthy. If the backend goes down, varnish will server stale content | |
# from the cache for up to 1 hour. | |
# 2. Varnish will pass X-Forwarded-For headers through to the backend | |
# 3. Varnish will remove cookies from urls that match static content file | |
# extensions (jpg, gif, ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # Massive html validation task | |
# | |
# This rake task comes from the nanoc validation task (http://gist.github.com/8961) | |
# Copy this Rakefile to the root of your htmls or add the task to your existing Rakefile | |
# and run: | |
# | |
# rake validate | |
# | |
# and that's all :) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #Nanoc validation task | |
# | |
# To use this validation task you need the w3c_validators gem | |
# gem install w3c_validators | |
# and run rake validate on your project root | |
# | |
require 'yaml' | |
require 'w3c_validators' | |
include W3CValidators | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function helps to build a relative path from the page to the output root. | |
# | |
# Usage: <img src="<%= page_depth @page.path %>images/hardon.png" alt="wadus" /> | |
def page_depth path | |
depth = "" | |
(path.split("/").size-1).times do | |
depth = depth + "../" | |
end | |
depth | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sips Flatten Filter for nanoc 2.1.1 | |
# | |
# Uses the 'sips' command line tool in Mac OS X to flatten Fireworks images | |
# Quick hack, use at your own risk. Don't blame us if it destroys your carefully | |
# crafted images | |
module Nanoc::BinaryFilters | |
class SipsFlattenFilter < Nanoc::BinaryFilter | |