Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
#!/sbin/runscript | |
# Copyright 1999-2004 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v 1.1 2006/07/04 16:58:38 voxus Exp $ | |
opts="${opts} upgrade reload configtest" | |
depend() { | |
need net | |
use dns logger |
# config.gem "rspec", :lib => false, :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec')) | |
# config.gem "rspec-rails", :lib => 'spec/rails', :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails')) |
set :application, "example.com" | |
set :deploy_to, "/var/www/#{application}" | |
role :app, "example.com" | |
role :web, "example.com" | |
role :db, "example.com", :primary => true | |
set :scm, :git | |
set :repository, "ssh://[email protected]/git/example.com" | |
set :branch, "origin/master" |
require 'digest/sha1' | |
module EasyAuth | |
# http://techspeak.plainlystated.com/2010/03/drop-dead-simple-authentication-for.html | |
# To generate a hashed password (in irb): | |
# require 'easy_auth' | |
# EasyAuth.hash('my_password') # Put this in AUTHORIZED_USERS | |
AUTHORIZED_USERS = { |
# This works with steak 0.3.x and rspec 1.x | |
# For steak --pre and rspec 2 see this fork: http://gist.github.com/448487 | |
# Put this code in acceptance_helper.rb or better in a new file spec/acceptance/support/javascript.rb | |
Spec::Runner.configure do |config| | |
config.before(:each) do | |
Capybara.current_driver = :selenium if options[:js] | |
end |
# Make gems available | |
require 'rubygems' rescue nil | |
require 'irb' rescue nil | |
require 'yaml' | |
Bundler.require(:default, :console) if defined?(Bundler) | |
alias q exit | |
class Object | |
def local_methods |
Some exercises from the Falsy Values workshops.
The good parts:
bash -c ' | |
<% if knife_config[:bootstrap_proxy] -%> | |
( | |
cat <<'EOP' | |
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %> | |
EOP | |
) > ~/.curlrc | |
<% end -%> | |
if [ ! -f /usr/bin/chef-client ]; then |
#!/bin/bash | |
# +----------------------------------------------------------------------+ | |
# | | | |
# | Mount the root file system / with the option noatime | | |
# | | | |
# | By Philipp Klaus <http://blog.philippklaus.de> | | |
# | Tip found on <http://blogs.nullvision.com/?p=275> | | |
# | | | |
# +----------------------------------------------------------------------+ |
find . -name '*ipa' -exec metaipa.sh {} \; |