gem install rails --pre
rails new my_app -T
namespace :staging do | |
desc 'create subdomain DNS record for Heroku review app' | |
task :publish_dns do | |
require 'dnsimple' | |
require 'platform-api' | |
STAGING_DOMAIN = 'mystagingdomain.com'.freeze | |
DNSIMPLE_ACCOUNT_ID = .freeze | |
heroku_app_name = ENV['HEROKU_APP_NAME'] | |
subdomain = heroku_app_name.match(/.*(pr-\d+)/).captures.first |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
/** | |
The following can replace the file in the Field Arrays example | |
(https://github.com/erikras/redux-form/tree/master/examples/fieldArrays) to demonstrate this functionality. | |
**/ | |
import React from 'react' | |
import { connect } from 'react-redux' | |
import { Field, FieldArray, reduxForm, formValueSelector } from 'redux-form' | |
import validate from './validate' |
require 'fileutils' | |
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku. | |
# The deploy branch is rebased onto master, so the push needs to be forced. | |
desc "Deploy app to Heroku after precompiling assets" | |
task :deploy do | |
deploy_branch = 'heroku' | |
remote = 'heroku' | |
deploy_repo_dir = "tmp/heroku_deploy" |
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn |
set nocompatible | |
let mapleader = "," | |
call pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
color herald |
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn |
def generate_secure_s3_url(s3_key) | |
# | |
# s3_key would be a path (including filename) to the file like: "folder/subfolder/filename.jpg" | |
# but it should NOT contain the bucket name or a leading forward-slash | |
# | |
# this was built using these instructions: | |
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html | |
# http://aws.amazon.com/code/199?_encoding=UTF8&jiveRedirect=1 | |
s3_base_url = MyApp::Application::S3_BASE_URL # i.e. https://mybucket.s3.amazonaws.com |