Skip to content

Instantly share code, notes, and snippets.

View pvrt's full-sized avatar

Pavel R pvrt

View GitHub Profile
@mileandra
mileandra / letsencrypt_setup.md
Last active April 9, 2020 19:39
Letsencrypt on Ubuntu 16.04 with Nginx, Rails and Capistrano-Unicorn-Nginx

Install Letsencrypt

Install with apt-get

$ sudo apt-get update    
$ sudo apt-get install letsencrypt

Generate a strong DH

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Configure nginx

@tomdalling
tomdalling / simple_authentication.rb
Created May 23, 2016 12:26
A simple Sinatra app that demonstrates basic authentication
#!/user/bin/env ruby
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'sinatra', '~> 1.4'
gem 'bcrypt', '~> 3.1'
end
require 'sinatra/base'
@joshrieken
joshrieken / Gulpfile.js
Last active February 2, 2025 02:36
Replacing Brunch with Gulp in Phoenix
// Contains support for: SASS/SCSS, concatenation, and minification for JS and CSS
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var compress = require('gulp-yuicompressor');
@tobernguyen
tobernguyen / deploy_rails_app.md
Last active May 26, 2025 20:58
Ruby on Rails Deployment on DigitalOcean

Ruby on Rails Deployment on DigitalOcean

Prequisites

  • HTTP server nginx
  • Rails web server passenger
  • Database PosgreSQL
  • Deployment utility mina

Step 1 - Create your droplet

@breim
breim / deploy.sh
Last active February 15, 2018 12:34
Deploy rails 4 with postgresql
### ssh to root in terminal with your server ip
ssh root@123.123.123.123
### Create new user
adduser deploy
### Set new users privileges
visudo
### Find user privileges section
@nicolas-besnard
nicolas-besnard / elasticsearch.sh
Last active March 12, 2018 13:18
Nginx + Puma + Rails + Capistrano on Ubuntu 14.04
#!/usr/bin/env bash
install_elasticsearch() {
echo " * -- Elasticsaerch -- *"
echo " * Update"
sudo apt-get -qq -y update
echo " * Install JDK"
sudo apt-get -qq -y install openjdk-7-jre-headless
echo " * Download deb (V1.4.2)"
@scarfacedeb
scarfacedeb / 1.form.html.haml
Last active January 18, 2023 22:35
Form with multiple button in rails
/ Form excerpt
= f.button t(".save"), class: "btn"
= f.button t(".publish"), class: "btn", name: "publish"
= f.button t(".test"), class: "btn", name: "test"
@seancdavis
seancdavis / image.rb
Last active August 18, 2024 19:08
Rails has_many :through Polymorphic Association (http://goo.gl/lxmehk)
# app/models/image.rb
class Image < ActiveRecord::Base
has_many :taggings, :as => :taggable
has_many :tags, :through => :taggings
end
@dfurber
dfurber / a_turbolinks_spinner.md
Last active January 30, 2018 07:32
Add a loading indicator to turbolinks so the user knows when pages are loading.
@hopsoft
hopsoft / db.rake
Last active November 13, 2025 15:40
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd