Skip to content

Instantly share code, notes, and snippets.

@daz4126
daz4126 / main.rb
Created July 27, 2011 18:06
Robot Factory part 1 - Adding and Deleting Resources in Sinatra
%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) }
@rpanachi
rpanachi / screen.txt
Created August 19, 2011 17:11
RVM Instalation
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.
@holman
holman / gemspec-usage.md
Created February 12, 2012 07:02
test/spec/mini

Just install this in your apps like so:

gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'

@sbusso
sbusso / simple_ruby_daemon.rb
Created March 5, 2012 13:50 — forked from mynameisrufus/.gitignore
Simple ruby daemon
#!/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
@marcinbunsch
marcinbunsch / codewall.badges.js
Created March 10, 2012 22:18
Coderwall - display missing badges
// 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
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
How to write MiniTest::Spec expectations

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").

Understanding MiniTest::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
@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

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.

Relevant links

@drogus
drogus / Gemfile
Created April 23, 2012 18:34
Webmachine + ActionView pt2
source "http://rubygems.org"
gem "webmachine"
gem "actionpack"
gem "thin"
gem "datamapper"
gem "dm-migrations"
gem "dm-sqlite-adapter"
gem "debugger"
@rubiojr
rubiojr / quick_vm.rb
Created May 7, 2012 11:44
Quick OpenStack Server Create with ruby Fog
#!/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'
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 20, 2024 12:37
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname