Skip to content

Instantly share code, notes, and snippets.

@bhavinjavia
bhavinjavia / gist:5829479
Last active December 18, 2015 18:59 — forked from jimbojsb/gist:1630790
Highlight code examples in Mac for Keynote

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@bhavinjavia
bhavinjavia / gist:1109982
Created July 27, 2011 17:57
Record Expiry as a DelayedJob or Rake task
class RecordExpirer
def self.run(scheduled_time = Time.now)
# trigger the job for first time
Delayed::Job.enqueue(RecordExpirer.new, :run_at => scheduled_time)
end
def perform
SomeModel.where(:created_at < 48.hours.ago).update_all(:status, 'EXPIRED')
end
@bhavinjavia
bhavinjavia / net_http_open_ssl_verify_peer_issue
Created March 3, 2011 07:28
Issue with Net::HTTP verify_mode OpenSSL::SSL::VERIFY_PEER
require 'net/https'
require 'uri'
server = 'https://github.com/'
uri = URI.parse(server)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@bhavinjavia
bhavinjavia / gist:591283
Created September 22, 2010 07:13
Liquid 2.2.4 issue on Ubuntu 10.04
Gemfile:
# Installing from fork to fix requirement of Rubygems v1.3.7 which is not provided by Heroku yet. This tag requires Rubygems v1.3.6
gem 'liquid', :git => 'git://github.com/GnomesLab/liquid.git', :tag => 'v2.2.4'
Last line in liquid.rb does this:
# Load all the tags of the standard library
#