Skip to content

Instantly share code, notes, and snippets.

View sunnyrjuneja's full-sized avatar

Sunny R. Juneja sunnyrjuneja

View GitHub Profile
describe OpenCivicData do
context 'with no api key' do
it 'raises a warning' do
expect { OpenCivicData.new(nil) }.to warn('Warning: Your API key may not be set')
end
end
end
class User < ActiveRecord::Base
# Omitted
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
end
test 'send_devise_notification queues into activejob' do
@user.save
assert_equal enqueued_jobs.size, 1 # Passes
### Keybase proof
I hereby claim:
* I am sunnyrjuneja on github.
* I am wasd (https://keybase.io/wasd) on keybase.
* I have a public key whose fingerprint is 0FC8 16B4 4CC8 EBDF 64A1 1A5A 26EC A78F 9C32 1A3F
To claim this, I am signing this object:
@sunnyrjuneja
sunnyrjuneja / gist:37b14b85b10bedcf8c0a
Created April 18, 2015 02:37
after_initialize and AR callbacks
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.2.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
require 'byebug'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@sunnyrjuneja
sunnyrjuneja / genmon.md
Last active September 10, 2015 05:52 — forked from jqtrde/genmon.md
class TestCase1
if false
def foo
'Hello World'
end
end
end
puts TestCase1.new.foo # test.rb:9:in `<main>': undefined method `foo' for #<TestCase1:0x007ffff35bfe78> (NoMethodError)