Skip to content

Instantly share code, notes, and snippets.

View melvinram's full-sized avatar

Melvin Ram melvinram

View GitHub Profile
FactoryGirl.define do
factory :order do
email 'some@email.com'
delivery_fee 6.99
amount 206.99
paid 0
comments 'This is some comment to order'
discount_client 5
association :delivery
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
Capybara.javascript_driver = :webkit
FactoryGirl.define do
# sequence :email do |n|
# "email#{n}@example.com"
# end
# factory :user do
# email { Factory.next(:email) }
# password "password"
# password_confirmation "password"
# association :account
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('spec/spec_helper.rb')
watch(%r{^spec/support/.+\.rb$})
end
guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do
# updated 12/07/2013
source 'https://rubygems.org'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# gem "cancan"
# Use Capistrano for deployment
jQuery.fn.context_ready = (selector, callback) ->
jQuery ->
callback() if jQuery("body").is(selector)
@melvinram
melvinram / 0_reuse_code.js
Created November 20, 2015 19:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@melvinram
melvinram / bookmarket.js
Created August 5, 2017 21:53
Copy Cookies To Clipboard
javascript:(function(){ var textArea = document.createElement("textarea"); textArea.style.position = 'fixed'; textArea.style.top = 0; textArea.style.left = 0; textArea.style.width = '2em'; textArea.style.height = '2em'; textArea.style.padding = 0; textArea.style.border = 'none'; textArea.style.outline = 'none'; textArea.style.boxShadow = 'none'; textArea.style.background = 'transparent'; textArea.value = document.cookie; document.body.appendChild(textArea); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; console.log('Copying text command was ' + msg); } catch (err) { console.log('Oops, unable to copy'); } document.body.removeChild(textArea); })();