Skip to content

Instantly share code, notes, and snippets.

# == Schema Information
#
# Table name: product_data
#
# id :integer(4) not null, primary key
# filename :string(255)
# content_type :string(255)
# size :integer(4)
# created_at :datetime
# updated_at :datetime
ProductDataController
#one method only used currently (rest to be deleted)
# POST /product_data
# POST /product_data.xml
def create
logger.info("POST /product_data")
@product_datum = ProductDatum.new(params[:product_datum])
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
-config = extjs_form_for [@matter, @item],:fileUpload => true,:form_var =>form_id,:config_only=>true do |f|
= f.error_messages
=f.check_box :done, :fieldLabel =>"Completed"
=f.text_field :item, :fieldLabel => "Task"
=f.text_field :asignee_name, :fieldLabel =>"Assigned To"
=f.date_field :delivery_date, :fieldLabel =>"Due", :value =>f.object.delivery_date ? f.object.delivery_date.strftime("%m-%d-%Y"):""
=f.check_box :critical, :fieldLabel =>"Critical"
=f.select :reminder, [["1 Day Before",1],["2 Days Before",2],["3 Days Before",3],["4 Days Before",4],["5 Days Before",5],["1 Week Before",7]],:fieldLabel =>"Reminder"
=f.numeric_field :estimate, :fieldLabel =>"Estimate"
=f.text_area :description
require 'hashie'
require 'faraday'
require 'faraday_middleware'
gem "multi_json"
module Meterman
class Client
def initialize(adapter = Faraday.default_adapter, host = Meterman.host,port = Meterman.port, options={})
@adapter,@host,@port, @http_options = adapter,host,port,options
@mwhagedorn
mwhagedorn / gist:1585124
Created January 9, 2012 21:46
Relevant fragment of server_spec
context "server#addresses" do
context "and there is a private address key" do
it "returns the ip address" do
@server.should_receive(:addresses).any_number_of_times.and_return({"private"=>[{"version"=>4, "addr"=>"10.0.2.76"}]})
@server.private_ip_address.should == "10.0.2.76"
end
end
context "and there is not a private address key" do
it "server#private_ip_address returns nil" do
#Stricly speaking this scenario cannot occur
GET https://csnode.rndd.aw1.hpcloud.net:35357/v2.0/HP-IDM/v1.0/domains/61087284261695/services
X-Auth-Token: HPAuth_4f4505c4e4b08770c1a88452
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip,deflate
---
---
200
@connection2 ||= Fog::Compute.new(
:provider =>'HP',
:hp_account_id =>"#{@user.tenant_id}:#{access_key[:access_key_id]}",
:hp_secret_key => access_key[:secret_key],
:hp_auth_uri =>"http://az1-nv-schedule-0000.rndd.aw1.hpcloud.net:8774/v1.1/#{@user.tenant_id}",
:connection_options =>{
:connect_timeout =>30,
:read_timeout =>30,
:write_timeout =>30
}
puts :hi
Exploring the Internet of Things using Ruby
We live in a world that is increasingly connected. Everything from toasters to televisions has smart network aware devices in them. In the past such devices were accessed via proprietary protocols, but there has been a movement as of late to allow open easy access to these kind of embedded devices.
We will look at the current understanding of the Internet of Things, and some of the embedded devices, such as the Arduino and other technologies that are making it possible.
USB, wireless and serial communication to embedded devices will be examined, all with Ruby of course. A few practical hardware examples will be presented, such as a software build state monitor using Ruby and USB to talk to an LED lamp and an LED message board using wireless communication and Arduino.
We will also go over a few examples of Cloud based offerings, which allow you to mash up your devices in your home to the World Wide Web, for remote monitoring or collaboration.