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
private string Post(string username, string password, string url, string xml)
{
string basicAuth = Convert.ToBase64String(Encoding.ASCII.GetBytes(String.Format("{0}:{1}", username, password)));
//create the web request
WebRequest request = WebRequest.Create(url);
request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Headers.Add("Authorization", "Basic " + basicAuth);
request.ContentType = "application/xml";
request.ContentLength = xml.Length;
# the main restful routes for the application
map.resources :grownups, :member => { :thumbnail => :get, :info => :get } do |grownups|
grownups.resources :kids, :member => { :set_name => :post,
:edit_daily_time_limits => :get,
:update_daily_time_limits => :put } do |kids|
kids.resources :page_requests, :member => { :unlock => :post,
:complete_unlock => :post,
:get_time_limit => :get,
:set_time_limit => :post }
kids.resources :time_limits
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{ msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |autotest|
output = autotest.results.last.slice(/(\d+)\s.*examples?,\s(\d+)\s.*failures?/)
if output =~ /[1-9]\sfailures?/
growl "Test Results", "#{output}", "~/Library/autotest/rails_fail.png", 2, "-s"
else
<list-entries type="array">
<list-entry>
<created-at type="datetime">
2008-11-07T19:39:42+00:00
</created-at>
<created-by-id type="integer">
9
</created-by-id>
<domain>
cnn.com
describe "create_snapshot" do
before(:each) do
@tr.ec2.stub!(:create_snapshot).and_return { @tr.ebs_volume_id.nil? ? nil : {"snapshotId" => "snap-123"} }
end
it "should create a snapshot of the current EBS volume" do
#@tr.ec2.stub!(:ebs_volume_id).and_return { "vol-123" }
@tr.ebs_volume_id = "vol-123"
@tr.create_snapshot.should == {"snapshotId" => "snap-123"}
end
virtual_resource(:virtualhost) do
def listen(port="80")
has_variable(:name => "port", :value => port)
port port
end
def virtual_host_entry(file)
if ::File.file?(file)
template file
ActionView::Base.send :include, SavageBeast::AuthenticationSystem
ActionController::Base.send :include, SavageBeast::AuthenticationSystem
# Include your application configuration below
PASSWORD_SALT = '48e45be7d489cbb0ab582d26e2168621' unless Object.const_defined?(:PASSWORD_SALT)
Module.class_eval do
def expiring_attr_reader(method_name, value)
class_eval(<<-EOS, __FILE__, __LINE__)
def #{method_name}
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at WPDConnection.WPDWrapper.WPD_nextContent()
at ExerpointsGUI.DeviceReader.loadExercisesFromDevice()
at ExerpointsGUI.MainForm.transferContent()
at ExerpointsGUI.MainForm.PanelTransfer_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
1)
'Time parsing should be able to parse months' FAILED
expected: 2592000,
got: 2678400 (using ==)
./spec/poolparty/core/time_spec.rb:21:
2)
'Script wrapped with a script save! should save the expansions' FAILED
expected: /expand_when 'cpu>90', 'memory>80'/,
got: "pool :appdotcomcoo do\n cloud :app do\n keypair 'snoodle'\nminimum_instances '2'\nmaximum_instances '5'\nami 'ami-123456'\nsecurity_group ''\nexpand_when 'cpu>1.9'\ncontract_when 'cpu<0.65'\nset_master_ip_to ''\n end\n\nend" (using =~)
NameVirtualHost *:443
<VirtualHost *:80>
ServerName <%= name %>
DocumentRoot <%= "/var/www/#{name}/public" %>
</VirtualHost>
<VirtualHost *:443>
ServerName <%= name %>
DocumentRoot <%= "/var/www/#{name}/public" %>