Skip to content

Instantly share code, notes, and snippets.

View deadprogram's full-sized avatar
💭
Upcoming availability for work.

Ron Evans deadprogram

💭
Upcoming availability for work.
View GitHub Profile
NameVirtualHost *:443
<VirtualHost *:80>
ServerName <%= name %>
DocumentRoot <%= "/var/www/#{name}/public" %>
</VirtualHost>
<VirtualHost *:443>
ServerName <%= name %>
DocumentRoot <%= "/var/www/#{name}/public" %>
# Example code for flying_robot
# Uses Ruby Arduino Development to create a library/interface for Unmanned Aerial Vehicles
# Written by Ron Evans (http://deadprogrammersociety.com)
#
# In order to implement a sketch that uses the flying_robot parser, you need to implement the methods that make up its interface
# so that it will respond to the standard command set.
#
# The following commands are supported:
# (h)ail - See if the UAV can still respond. Should send "Roger" back.
# (s)tatus - Grab a snapshot of all instrument readings plus any other status info that the UAV can support
/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
task :database_symlink, :role => :web do
run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml"
run "chown -R www-data:www-data #{release_path}"
end
namespace :deploy do
desc "Restart the Passenger system."
task :restart, :roles => :app do
database_symlink
passenger.restart
if verify_recaptcha
@thing.save!
redirect_to success_path
else
flash[:error] = "There was an error with the recaptcha code below. Please re-enter the code and click submit."
render :action => 'new'
end
if verify_recaptcha(@thing) && @thing.save!
redirect_to success_path
else
render :action => 'new' # error shown in view
end
# Copyright (c) 2005 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
P1 -> propeller(:motor)
P2 -> led
P3, P4 <-> xbee(:serial)
P6 <- button(:button)
P7 <- thermometer(:analog)
every 100ms do
if button.pushed
led.off
end
# GET /user/1/time_spent
def time_spent
@time_spent = @user.time_spent
respond_to do |format|
format.xml { render :xml => @time_spent.to_xml }
format.json { render :json => @time_spent.to_json }
format.png { send_data(Spark.plot( @time_spent, :has_min => true, :has_max => true, 'has_last' => 'true', 'height' => '30', :step => 10 ), :type => 'image/png',
:filename => "#{@user.login}_time_spent.png",
:disposition => 'inline') }
image_tag(time_spent_user_path(current_user, :format => 'png'))