Skip to content

Instantly share code, notes, and snippets.

require 'clojure'
class MyClojureObj < Clojure::Object
def initialize
dosync { @foo = 'foo' }
end
def foo; @foo; end
def foo=(f); @foo = f; end
end
# lexically sort filenames
--sort-files
# Pipe the output through a pager by default
# --pager=less
# Highlight the matching text
--color
# Print 1 line of output context
This is basically a dirty hack :) I have no idea if messing with the default OSX apache config this way is frowned upon. My view is that it works now, and if it breaks I'll fix it.
Add any domains you want to blacklist to /etc/hosts, pointing at 127.0.0.1. You need to enable web sharing to get apache running of course.
Changes to the default /etc/apache2/httpd.conf
==============================================
Listen 127.0.0.1:80 # so that the world can't see the list
DocumentRoot "/Library/WebServer/Documents/public" # to fit in with passenger, you need to create the public dir (and maybe /tmp too)
require 'test/unit'
require 'shoulda'
class HelpersTest < Test::Unit::TestCase
# ServerHelpers is the module that has all the sinatra helpers
include ServerHelpers
context "a helper" do
should "return a number" do
assert_equal 42, my_helper_method
@cypher
cypher / canine.rb
Created December 16, 2009 10:33 — forked from h0rs3r4dish/canine.rb
class Canine
VERSION = '1.3'
def initialize(&block)
@commands = Hash.new
@default = @latest = :commands
@empty = nil
@auto = {
:commands => hash_command("commands","Show a list of commands",Proc.new {
@commands.each { |cmd| c = cmd[1]
name = c[:name].to_s
#!/usr/bin/env ruby
script = <<-BASH
if [ ! -n "${foobar+x}" ]; then \
echo "foobar is unset"; \
elif [[ ${!foobar[@]} ]]; then \
if [[ $foobar ]]; then \
echo "foobar is set"; \
else \
echo "foobar is set, but empty"; \
require 'sinatra'
class SinatraApp < Sinatra::Base
get '/' do
SinatraApp.environment.inspect
end
end
run SinatraApp
From 6a9579d52d531a29ea1b8bc9e9dbb61385f53197 Mon Sep 17 00:00:00 2001
From: Markus Prinz <markus.prinz@nuclearsquid.com>
Date: Wed, 28 Oct 2009 22:21:02 +0100
Subject: [PATCH] You have to run ./configure before running rake when compiling Rubinius for the first time
---
doc/getting_started.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/doc/getting_started.txt b/doc/getting_started.txt
require 'sinatra'
class App < Sinatra::Base
get '' do
request.script_name
end
end
map '/foo' do
run App
#!/usr/bin/env ruby
#
# Released under MIT License
# Copyright (c) 2009 Markus Prinz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is