Skip to content

Instantly share code, notes, and snippets.

View supairish's full-sized avatar
🏂
Shreddin

Chris Irish supairish

🏂
Shreddin
View GitHub Profile

Goals of this tutorial:

  • deploy a new Rails app with capistrano
  • make it fast (total process takes less than 5 minutes)
  • make it simple (no unecessary config)
  • manual ssh to the server not required

Rails application stack:

  • nginx
  • unicorn
  • postgresql
@supairish
supairish / nginx.conf
Last active September 22, 2016 02:18 — 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
@supairish
supairish / ember_deploy.sh
Last active September 14, 2015 17:07 — forked from skwp/ember_deploy.sh
#!/bin/bash
# Fail if any commands fail
set -e
set -o pipefail
# These are ec2 tags from which we will determine where to deploy
ec2_stage=$DEPLOY_STAGE
ec2_app="core"
ec2_role="app"
@supairish
supairish / fuelux-repeater-dynamic
Created February 19, 2016 18:58 — forked from mbeard/fuelux-repeater-dynamic
Example of the Fuel UX repeater bound to a dynamic datasource (backed by an API).
<!DOCTYPE html>
<html class="fuelux">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Snippets</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- dependencies -->
@supairish
supairish / 20130822132243_change_product_long_description.rb
Created July 26, 2016 02:18 — forked from jenheilemann/20130822132243_change_product_long_description.rb
Rails migrations: String to Text and back again. It's kind of complicated to update a database column that is currently a "string" and convert it into "text." Well, it's not hard to update the column, but it can be dangerous if you need to rollback the migration - Postgresql and other databases don't like adding a limit to the column, and the `r…
class ChangeProductLongDescription < ActiveRecord::Migration
def up
# simple and straightforward
change_column :products, :long_description, :text
end
# but why cant it just be:
# change_column :product, :long_description, :string
# ???
# because effin databases don't like you, that's why.
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
myService: Ember.inject.service()
});
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
@supairish
supairish / web-fonts-asset-pipeline.md
Created October 26, 2017 07:44 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do