Skip to content

Instantly share code, notes, and snippets.

View giridhar's full-sized avatar

Giridhar giridhar

View GitHub Profile
@giridhar
giridhar / nginx.conf
Created April 26, 2017 17:38 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@giridhar
giridhar / docker_image_tag_push.txt
Last active April 18, 2017 13:44
docker image tagging
docker login
docker tag myproject_website coolrider/rails5:latest
docker push coolrider/rails5:latest
# -*- mode: ruby -*-
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-6.8"
config.vm.network "forwarded_port", guest: 4000, host: 4000
config.vm.network "forwarded_port", guest: 9200, host: 9222
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "Developer", "/home/vagrant/Developer"
@giridhar
giridhar / webscrapper-nokogiri.rb
Last active December 14, 2015 21:19
Example that shows how to scrape webpage using nokogiri and xpath.
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML::Document for the page we’re interested in...
doc = Nokogiri::HTML(open('http://en.wiktionary.org/wiki/Appendix:Indian_surnames'))
#Search for nodes by xpath
doc.xpath('/html/body/div[3]/div[3]/div[4]/ul/li').each do |link|
puts link.content
end
@giridhar
giridhar / clothes_recommender
Created November 25, 2011 07:02
Creating a Clothes Recommender
#Prerequisites
#Basic Ruby/Rails knowledge, including an installed version of Ruby 1.9.2, Rubygems, Bundler, and Rails 3.
#Basic Git knowledge, including an installed version of Git.
#Create a Heroku account http://www.heroku.com/
#All the commands work on linux
#Install the Heroku client:
$ gem install heroku
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
delegate :author , :to => user
end