Skip to content

Instantly share code, notes, and snippets.


Sunny R. Juneja sunnyrjuneja

View GitHub Profile
View open_civic_data_spec.rb
describe OpenCivicData do
context 'with no api key' do
it 'raises a warning' do
expect { }.to warn('Warning: Your API key may not be set')
View gist:0fb1a69ae346414469fd
class User < ActiveRecord::Base
# Omitted
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
test 'send_devise_notification queues into activejob' do
assert_equal enqueued_jobs.size, 1 # Passes
View gist:7afe855d9ee2435fe983
### Keybase proof
I hereby claim:
* I am sunnyrjuneja on github.
* I am 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 / gist:37b14b85b10bedcf8c0a
Created Apr 18, 2015
after_initialize and AR callbacks
View gist:37b14b85b10bedcf8c0a
# 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,, and on the same machine using a single IP address.

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

View test.rb
class TestCase1
if false
def foo
'Hello World'
puts # test.rb:9:in `<main>': undefined method `foo' for #<TestCase1:0x007ffff35bfe78> (NoMethodError)