Skip to content

Instantly share code, notes, and snippets.

# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName example.com
# ServerAlias *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
@mr-rock
mr-rock / sinatra_jquery_test.rb
Created October 9, 2009 11:40
An example of Sinatra working with Ajaxified JQuery based on some pieces of code published by Rafael George on the Sinatra Google Group.
require 'sinatra'
require 'dm-core'
require 'haml'
DataMapper.setup(:default, 'sqlite3::memory:')
class Message
include DataMapper::Resource
property :id, Serial
@hugs
hugs / LICENSE
Created February 15, 2010 01:45
The Node.js "Hello World" web server ported to CoffeeScript
I, Jason Huggins, the author of the work "CoffeeScript Web Server" (2010), irrevocably renounce
all current and future legal rights to the work in any medium whatsoever.
I stand behind the merit of the work, but disclaim all liability for it under law.
I encourage you, the audience, to share, copy, distribute, perform, remix, mash up, interpret,
excerpt, translate, and otherwise enjoy and use the work as you will.
I request that you acknowledge my authorship.
# [sudo] gem install rack
# ruby -rubygems server.rb
# open http://localhost:9292 in browser.
require 'rack'
require 'erb'
TEMPLATE = File.read("template.erb")
server = lambda do |env|

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@cowboy
cowboy / github_post_recieve.php
Created October 11, 2010 02:04
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
run "rm public/index.html"
file "Isolate", <<-END
gem "rails", "3.0.0"
gem "haml", "3.0.18"
gem "sqlite3-ruby", "1.3.1"
env :development do
gem "thin", "1.2.7"
gem "haml-rails", "0.2"
@ryanb
ryanb / application.html.erb
Created January 19, 2011 19:31
Example of very simple password authentication.
<!-- layout file -->
<% if current_user %>
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>.
<% end %>
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.
@chrissharkey
chrissharkey / agedate.html
Created March 7, 2011 23:51
Calculate the age of person you can date based on your net worth
<html>
<head>
<title>Age Dating Calculator</title>
<script>
<!--
/* This function does the actual calculation as described in your email*/
function calculate(age, worth) {
/* If they are less than 14 assume they wouldn't date anyone more than 1 year