Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Copy this script to hooks/post-receive in your main git repository
# in order to prompt integrity to build the latest version of your project
# when changes are pushed. Don't forget to make it executable with chmod +x.
HOSTNAME="your.integrity.server"
# Set the username and password if your server is protected with basic auth
#
# I'm rather pleased with this use of Python decorators for applying
# stubs to a class before a test method.
#
# It feels a bit like a poor man's shoulda. :-)
import os
import unittest2 as unittest
import satisfaction
server {
listen 80;
server_name effectif.com;
root /var/apps/nesta/current/public;
passenger_enabled on;
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
}
get "/" do
set_common_variables
set_from_config(:title, :subtitle, :description, :keywords)
@heading = @title
@title = "#{@title} - #{@subtitle}"
@articles = Page.find_by_path("news").articles[0..7]
@body_class = "home"
cache haml(:index)
end
/* Multiget web service, written in Node
http://127.0.0.1:9001/?urls=http://example.com/,http://example.net/
Will fetch all URLs in parallel, then return a JSON response containing
the fetched content from them.
*/
var DEFAULT_TIMEOUT = 10000;
<commandset>
<command id="wordtracker-review-links-command"
oncommand="WT.LinkBuilder.reviewLinks()"/>
</commandset>
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="wordtracker-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="Wordtracker"
tooltiptext="Open the Wordtracker menu"
#!/bin/bash
# The script that I use to launch unicorn, running Rails 2.3 apps with
# Rack apps mounted within via Metal.
#
# The situation seems to be complicated by the fact that I deploy with one
# user account, and run my apps with another one (that has no perms - why do
# so few Ruby developers do this?). Getting sudo to set the path such that
# bundler could find everything it needed under the app's user account wasn't
# working out; hence this script. Run with sudo.
@gma
gma / app.rb
Created September 27, 2010 17:21
Enabling article dates in Nesta URLs
# This code enables URLs with dates in for pages that have date set.
#
# If you use this code then a page published on 27 September 2010 with a path
# (relative to Nesta's content directory) of /foo/bar will now be available
# from /2010/09/07/foo/bar.
#
# Installation:
#
# $ mkdir -p local
# $ cat >> local/app.rb # (paste the following code, then press ^D)
@gma
gma / app.rb
Created September 28, 2010 15:54
# To redirect to your latest article when somebody hits the home page
# of your Nesta site, try this:
#
# $ mkdir -p local
# $ cat >> local/app.rb # then paste in this code and type Ctrl-D
get "/" do
latest = Page.find_articles[0]
redirect latest.abspath
end
poncho% ~/bin/gist < foo.txt
#<Net::HTTPFound 302 Found readbody=true>
https://gist.github.com/gists/new