Skip to content

Instantly share code, notes, and snippets.

View mikeymckay's full-sized avatar

Mike McKay mikeymckay

View GitHub Profile
crazy@paiute:/var/www/somerset$ rake
(in /var/www/somerset)
no such file to load -- application.rb
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_file'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:379:in `load_file'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:259:in `require_or_load'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:224:in `depend_on'
/var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:136:in `require_dependency'
Feature: Logging in
In order to securely access the system's features
Users should have to login with a username and password
Scenario: View login screen
Given I am not logged in
When I access a page
Then I should be redirected to the "login" page
And I should see "Enter Username"
And it should look like login_user.jpg
@mikeymckay
mikeymckay / gist:141114
Created July 5, 2009 20:49
Spreadems - sms from a spreadsheet
require 'rubygems'
require 'sinatra'
require 'roo'
get '/' do
sample_data = [
["12025551212", "Happy New Year"],
["12025551212", "Happy Easter"],
["12025551212", "Happy Kwanza!!!"]
]
Scenario: Delete a project
Given I have logged in as "francine@hullaballoo.com"
And I have a project named "Ugandan Farm News"
And I am on the project page "Ugandan Farm News"
When I press "Delete Project"
Then I should see "'Ugandan Farm News' has been deleted"
<div class="errorbox-good">
<div class="ss-item ss-text"><div class="ss-form-entry"><label class="ss-q-title" for="entry_0">Prepared By
</label>
<label class="ss-q-help" for="entry_0"></label>
<input type="text" name="entry.0.single" value="" class="ss-q-short" id="entry_0"></div></div></div>
<br> <div class="errorbox-good">
<div class="ss-item ss-text"><div class="ss-form-entry"><label class="ss-q-title" for="entry_1">BHS/RHU Name
</label>
<label class="ss-q-help" for="entry_1"></label>
<input type="text" name="entry.1.single" value="" class="ss-q-short" id="entry_1"></div></div></div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><link rel="shortcut icon" href="http://www.google.com/images/spreadsheets/forms/favicon.ico" type="image/x-icon">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>FHSIS</title>
<script>
/*
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
# RSpec
require 'spec/expectations'
# Webrat
require 'webrat'
require 'test/unit/assertions'
World(Test::Unit::Assertions)
Webrat.configure do |config|
#!/bin/sh
# ------------------------------
# Added by tarlac_install script
# ------------------------------
# See autossh and google for reverse ssh tunnels to see how this works
# When this script runs it will allow you to ssh into this machine even if it is behind a firewall or has a NAT'd IP address.
# From any ssh capable machine you just type ssh -p $PORT_MIDDLEMAN_WILL_LISTEN_ON localusername@middleman
# This is the username on your local server who has public key authentication setup at the middleman
#!/usr/bin/ruby
output = ""
application_path = File.dirname(__FILE__)
command = "pocketsphinx_continuous -hmm /usr/share/pocketsphinx/model/hmm/wsj1 -lm #{application_path}/voice_recognition/7892.lm -dict #{application_path}/voice_recognition/7892.dic 2>/dev/null"
def fork_off(command)
puts "Forking off #{command}"
(pid = fork) ? Process.detach(pid) : exec(command)
end
def recent
@curb.url = "https://www.google.com/voice/inbox/recent/"
@curb.http_get
doc = Nokogiri::XML::Document.parse(@curb.body_str)
data = doc.xpath('/response/json').first.text
html = Nokogiri::HTML::DocumentFragment.parse(doc.to_html)
json = JSON.parse(data)
# Format for messages is [id, {attributes}]
json['messages'].map do |conversation|
next if conversation[1]['type'].to_i != GOOGLE_VOICE_SMS_TYPE