Skip to content

Instantly share code, notes, and snippets.

View Animeshjain2405's full-sized avatar
🎯
Focusing

Animesh Jain Animeshjain2405

🎯
Focusing
View GitHub Profile
@Animeshjain2405
Animeshjain2405 / nginx.conf
Created September 17, 2019 08:15 — 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
@Animeshjain2405
Animeshjain2405 / SomeController.rb
Created July 12, 2016 08:00 — forked from ktkaushik/SomeController.rb
Using Prawn in your Rails App to download and attach the pdf in your email
require 'pdf_generator'
class TasksController < ApplicationController
include PdfGenerator
def some_action
pdf_generator( download = true )
end
end
require 'rubygems'
require 'zip/zip'
def unzip_file (file, destination)
Zip::ZipFile.open(file) { |zip_file|
zip_file.each { |f|
f_path=File.join(destination, f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
}