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
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 |
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
/* 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; |
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
<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" |
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
#!/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. |
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 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) |
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
# 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 |
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
poncho% ~/bin/gist < foo.txt | |
#<Net::HTTPFound 302 Found readbody=true> | |
https://gist.github.com/gists/new |
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
#!/bin/sh | |
## Functions | |
usage() | |
{ | |
echo "Usage: $(basename $0) <name>" 1>&2 | |
exit 1 | |
} |
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
#!/bin/sh | |
to_grep() | |
{ | |
ls | grep -v db | grep -v logs | |
} | |
contains_merge_marks() | |
{ | |
local files=$* |
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
ENV["PATH"] = "/opt/ruby/bin:#{ENV['PATH']}" | |
ENV["RAILS_ENV"] = "production" | |
ENV["QUEUE"] = "*" | |
Bluepill.application("nichelator") do |app| | |
app.working_dir = "/var/apps/nichelator/current" | |
app.uid = "app" | |
app.gid = "app" | |
2.times do |i| | |
app.process("resque-#{i}") do |process| |