Skip to content

Instantly share code, notes, and snippets.

View faraazkhan's full-sized avatar
🏠
Working from home

Faraaz Khan faraazkhan

🏠
Working from home
View GitHub Profile
@faraazkhan
faraazkhan / stepdefinition.rb
Created August 23, 2011 21:06
Cucumber Step Definition
# step helpers
def create_user(options)
@users ||= {}
role_name = options.delete :role_name
email = "#{role_name.downcase.gsub(' ','.')}@blackmanjones.com"
options[:email] = email
options.merge!(:username => email, :email => email, :password => 'password', :password_confirmation => 'password')
@users[role_name] ||= begin
user = User.make(options)
@faraazkhan
faraazkhan / reporter.rb
Created May 30, 2012 17:10
Reporting Engine Sample Code
class Reporter
include ActionController::UrlWriter
include ActionController::Routing::Helpers
attr_accessor :models_to_include
def initialize(params)
@params = replace_placeholder_values(params.dup)
if @params['klass']
@faraazkhan
faraazkhan / Capistrano-Deployment-Recipe.rb
Created October 2, 2012 03:31 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@faraazkhan
faraazkhan / complaint_query.rb
Created October 13, 2012 18:54
Reporter Query
class CustomQueries::ComplaintQuery < CustomQueries::ReporterQuery
@@select = {
'Record ID' => 'complaints.id',
'Transmittal Date' => "complaints.transmittal_date",
'Student ID' => "IFNULL(students.student_id, 'Student Not Identified')",
'Student Last Name' => 'IFNULL(students.last_name, IFNULL(complaints.student_last_name_entry_text, mandates.student_last_name_entry_text))',
'Student First Name' => 'IFNULL(students.first_name, IFNULL(complaints.student_first_name_entry_text, mandates.student_first_name_entry_text))',
'Student DOB' => "IFNULL(students.dob, complaints.student_born_on_entry_text)",
'Current Attending School' => 'IFNULL(current_school.name, "Not Enrolled")',
'Attorney' => "CONCAT(attorney.first_name, ' ', attorney.last_name)",
@faraazkhan
faraazkhan / pickjdk.sh
Created May 20, 2013 18:55
Pick your JDK on a mac
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
_macosx()
{
if [ $(uname -s) = Darwin ]; then
@faraazkhan
faraazkhan / features.rb
Created July 19, 2013 14:49
Simple Utility to create To start using this: First gem install jira-ruby Then change the following constants to your preferences: USERNAME PASSWORD URL FEATURE_DIRECTORY EXTENSION to run this code try ``` ruby features.rb hioshc-23 ``` KNOWN ISSUE: ONCE IN A WHILE THE JIRA API BLOCKS ACCESS TO THE APPLICATION FROM LOCAL. YOU WILL SEE THE FOLLOW…
require 'rubygems'
require 'jira'
require 'fileutils'
class Features
USERNAME='yourJIRAusername'
PASSWORD= 'yourJIRApassword'
URL= 'https://www.cws-cgicloud-apps.com:8443'
FEATURE_DIRECTORY= 'Full Path to the Directory Where you would like to save the Feature file'
EXTENSION='The extension you would like for the file. Example for .feature just type feature here'
def self.jira
@faraazkhan
faraazkhan / nginx.sh
Created September 23, 2013 16:45
Kill nginx first: sudo kill `cat /usr/local/nginx/logs/nginx.pid` Nginx init file. Location: sudo nano /etc/init.d/nginx Execute: sudo chmod +x /etc/init.d/nginx Chkconfig: sudo /sbin/chkconfig nginx on Verify: sudo /sbin/chkconfig --list nginx sudo /etc/init.d/nginx start ... sudo /etc/init.d/nginx stop ... sudo /etc/init.d/nginx restart ... su…
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
@faraazkhan
faraazkhan / Gemfile.lock
Created October 22, 2013 17:33
Gemfile.lock to reproduce Cucumber Outline issue with Sauce-Cucumber
PATH
remote: .
specs:
cms_automation (0.0.1)
activesupport
capybara (~> 2.0.3)
capybara-webkit
cucumber (>= 1.3.6)
hirb
launchy
require 'csv'
require 'json'
require 'net/http'
class ServiceValidator
@url = 'http://medicare.gov/physiciancompare/(X(1)S(tposse1fuc432hcyz5boheok))/services/PhysicianCompare.svc/GetSymptomSpecialties?symptomid=279&bodypartid=1&selected=M&AspxAutoDetectCookieSupport=1'
def validate
call_service
parse_expected_response
validate_response
@faraazkhan
faraazkhan / InterrogationController Error
Created March 29, 2014 16:08
From http://localhost:3000/my_panes/my_reports
Processing InterrogatorController#show to json (for 127.0.0.1 at 2014-03-29 12:06:51) [GET]
Parameters: {"controller"=>"interrogator", "klass"=>"Mandate", "action"=>"show", "format"=>"json"}
ArgumentError (A copy of Authentication has been removed from the module tree but is still active!):
rake (0.9.2.2) lib/rake/ext/module.rb:36:in `const_missing'
lib/authentication.rb:34:in `current_user'
lib/authentication.rb:50:in `logged_in?'
lib/authentication.rb:54:in `login_required'
honeybadger (1.5.0) lib/honeybadger/rack.rb:42:in `call'
/Users/faraaz/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'