Skip to content

Instantly share code, notes, and snippets.

Sunny R. Juneja sunnyrjuneja

  • SF Bay Area
Block or report user

Report or block sunnyrjuneja

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.rb
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)
View nginxproxy.md

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 / 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)
View gist:7afe855d9ee2435fe983
### 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:
View gist:0fb1a69ae346414469fd
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
View open_civic_data_spec.rb
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
You can’t perform that action at this time.