Skip to content

Instantly share code, notes, and snippets.

View vijendra's full-sized avatar

Vijendra Rao vijendra

View GitHub Profile
@vijendra
vijendra / API.md
Last active April 11, 2022 06:11 — forked from iros/API.md
AYUSLAB REST APIs

1. Ayuslab Order Create API

Rest API excpects JSON data as payload.

Packages array should contain name and code of test packages/special packages, if any.

Tests array should contain name and code of each prescribed test.

BillItems array can include billable items other than lab tests and packages, if any. For example, home collection charge, doctor consultation charges etc.

@vijendra
vijendra / wufoo_callback_rails.rb
Last active August 29, 2015 14:07
Parse wufoo callback url data in rails
#Parse to get {"Location"=>"Field1", "First"=>"Field104", "Last"=>"Field105", "Email"=>"Field106"} Don't forget to check "Include Field and Form Structures with Entry Data (?)" in wufoo webhook setting.
title_to_labels = {}
fields_structure = MultiJson.decode(data['FieldStructure'])
fields_structure["Fields"].each do |field_structure|
unless field_structure.keys.include?('SubFields')
title_to_labels[ field_structure["Title"] ] = field_structure["ID"]
else
field_structure["SubFields"].each do |sub_field_structure|
<ol id="project_credits">
<li class="full credit project_credit first">
<div class="credit-label">
<label for="project_new_project_credit_attributes__label">Label</label>
<input class="label text" id="project_new_project_credit_attributes__label" name="project[new_project_credit_attributes][][label]" size="30" type="text">
</div>
<div class="credit-url">
<label class="block with-instr" for="project_new_project_credit_attributes__description">Credit <span class="instr">"link text":http://abcd.com/</span></label>
<input class="label text" id="project_new_project_credit_attributes__description" name="project[new_project_credit_attributes][][description]" size="30" type="text">
</div>
Given /^I am logged in as an admin$/ do
u= User.make(:admin)
u.has_role!('admin')
visit new_user_session_path
fill_in(:email, :with => 'admin@example.com')
fill_in(:password, :with => 'password')
click_button('Login')
end
@vijendra
vijendra / Jabber-SH
Created April 16, 2010 09:36 — forked from pcreux/Jabber-SH
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com
@vijendra
vijendra / gist:355150
Created April 4, 2010 05:51
cucumber feature for testing account activation
Scenario: Want to confirm account using mail activation link in the activation email
Given I have registered successfully
Then I should receive an activation email
When I click the account activation link in email
Then I should see "Your account is successfully activated."
And I should receive wecome email
#registration_steps.rb
When /^I click the account activation link in email$/ do
When 'I click the first link in the email'
def deliver_welcome!
reset_perishable_token!
Notifier.deliver_welcome(self)
end
#Welcome method in Notifier
def welcome(user)
subject "Welcome to aplication name!"
from "Aplication name<admin@aplication.com>"