Skip to content

Instantly share code, notes, and snippets.

@robotarmy
robotarmy / codelistinghelper.tex
Created July 25, 2012 18:42
How to layout code listings with a caption and a frame around the code
\usepackage{color}
\usepackage{xcolor}
\usepackage{calc}
\newlength\captionLeftDimension
\newlength\captionRightDimension
\setlength\captionLeftDimension{ \fboxsep+(\fboxrule*3)}
\setlength\captionRightDimension{-\fboxsep+(\fboxrule*3)}
\usepackage{listings}
\lstset{frame=single,
@robotarmy
robotarmy / Blog.creole
Created May 15, 2012 18:36
Building Small Web Services with a Heroku and Unicorn Sinatra Template Project

Using Sinatra Unicorn and Heroku (CEDAR stack) Together!

I have been asked

  • "How do I get started with Unicorn and Heroku?"
  • "How can I made a remote HTTP webhook?"
  • "How can I make a simple web service?" ,
  • "How can I get started with a free ruby hosting evironment?"

I want to take a moment to answer a few of these questions in a small package I have

<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="my.css" />
<style>
/* App custom styles */
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
@robotarmy
robotarmy / delete_labels.rb
Created March 30, 2012 23:13 — forked from visnup/import_issues.rb
hacky script to import pivotal tracker csv into github issues
#encoding:UTF-8
#!/usr/bin/env ruby
require 'rubygems'
require 'FasterCSV'
require 'httparty'
require 'json'
require 'highline/import'
def get_input(prompt="Enter >",show = true)
@robotarmy
robotarmy / Gemfile
Created March 23, 2012 23:55
Adding Rake to Sinatra with Rspec
gem 'sinatra'
group :development,:test do
gem 'rspec'
gem 'rack-test'
end
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'sqlite3'
group :development, :test do
gem 'rspec-rails'
end
o_o:suggestotron/ $ rake cucumber FEATURE=features/1_topics.feature [7:23:30]
(in /Users/o_o/Class/Railsbridge-Q2/rubyonrails/suggestotron)
bundle exec /Users/o_o/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -I "/Users/o_o/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib:lib" "/Users/o_o/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber" --profile default features/1_topics.feature
Using the default profile...
Feature: Topics
In order to see a list of potential topics for meetings
people need to be able to create and edit them
Scenario: Getting to the new topic page # features/1_topics.feature:5
When I go to the topics page # features/step_definitions/web_steps.rb:48
diff --git a/support/env.rb b/support/env.rb
index bf06218..cc63886 100644
--- a/support/env.rb
+++ b/support/env.rb
@@ -4,56 +4,36 @@
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
-ENV["RAILS_ENV"] ||= "test"
-require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
@robotarmy
robotarmy / FrequencyCount.st
Created April 14, 2011 17:55
splitOn: creates an ordered Collection from a ' ' object (Text? String? SomethingEls?)
Transcript clear.
dc := Dictionary new.
b := ' t aoeu a aoeu aou aoeu' splitOn: ' '.
b do: [:e |
dc at:e ifAbsentPut: [ 0 ].
dc at:e put: ((dc at: e) + 1).
].
Transcript show: dc.
require 'spec_helper'
describe FeedbackController do
describe "actions" do
it "#create" do
questions = ['what do you like most?','what is your favorite colour?'],
answers = ['I like life!', 'I like green'],
comment = %%Blue is also nice, Red is the colour of blood, tomatoes,
and sunsets over the ocean when the light is just right%,
page_url = %%http://url%