Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
%w[sinatra dm-core dm-migrations slim sass].each{ |lib| require lib } | |
DataMapper.setup(:default, ENV['DATABASE_URL'] || File.join("sqlite3://",settings.root, "development.db")) | |
class Robot | |
include DataMapper::Resource | |
property :id, Serial | |
property :top, Integer, :default => proc { 1+rand(6) } | |
property :middle, Integer, :default => proc { 1+rand(4) } | |
property :bottom, Integer, :default => proc { 1+rand(5) } |
user@ubuntu:~$ sudo apt-get install git-core curl | |
user@ubuntu:~$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
Cloning into rvm... | |
remote: Counting objects: 5375, done. | |
remote: Compressing objects: 100% (2544/2544), done. | |
remote: Total 5375 (delta 3492), reused 3850 (delta 2113) | |
Receiving objects: 100% (5375/5375), 1.84 MiB | 1.21 MiB/s, done. | |
Resolving deltas: 100% (3492/3492), done. |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
#!/usr/bin/env ruby | |
# == Simple Daemon | |
# | |
# A simple ruby daemon that you copy and change as needed. | |
# | |
# === How does it work? | |
# | |
# All this program does is fork the current process (creates a copy of | |
# itself) then exits, the fork (child process) then goes on to run your | |
# daemon code. In this example we are just running a while loop with a |
// How to use this: | |
// 1. Go to the desired profile page on coderwall, like http://coderwall.com/marcinbunsch | |
// 2. Paste this gist in the JS console | |
// | |
// You can also probably use this in greasemonkey and dot.js | |
// | |
// Also, it was tested in Chrome, Firefox and Safari, it probably will | |
// not work in IE, but I just don't care about it ;) | |
// | |
// UPDATE: Coderwall made changes to the site and I cannot retrieve the achievements, so they are hardcoded, taken from a cached version of the achievements page |
I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").
Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):
# minitest/spec.rb
module MiniTest::Expectations
These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.
Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.
source "http://rubygems.org" | |
gem "webmachine" | |
gem "actionpack" | |
gem "thin" | |
gem "datamapper" | |
gem "dm-migrations" | |
gem "dm-sqlite-adapter" | |
gem "debugger" |
#!/usr/bin/env ruby | |
# | |
# Before we start, make sure you have Essex support in Fog | |
# | |
# Essex support has not been merged into upstream Fog so you'll need | |
# a custom ruby fog build to run through the examples | |
# | |
require 'fog' | |
require 'pp' | |
require 'highline/import' |