Free Quick Start Tools When Building Websites

When I’m creating a site there’s certain things that I need to create each time.

Here’s a list of some of my favorite tools – each free:

Name Generator

Namelix – enter a term (or terms) and this AI powered tool gives you name suggestions.  I usually add additional search criteria to only suggest to names with available domains

Privacy Policy

Shopify Privacy Policy Generator – create a privacy policy for your site

 

Terms of Use

Shopify Terms and Conditions Generator – creates terms geared more towards sites that sell products or services

Termly – can create terms geared towards SaaS products (paid and free options)

 

Cookie Warning/GDPR

Cookie Consent by Insites – makes it easy to create a warning to all site visitors that you use cookies

Design

BEE Free – use their tool to create responsive email designs

 

Advertisements

Customize Form for Mailchimp

I bought a HTML template that had an email subscription form and I wanted to make it work with Mailchimp.  I wanted to keep the style of the template and not use a Mailchimp styled one.

It took some work, and I didn’t find documentation to do it, so here’s what I did:

(1) I went to my email list in Mailchimp and then Form Builder (Signup forms > Form Builder)

(2) Go to the URL provided for the form

(3) On the page that the URL takes you to (with the form), view the page source

(4) Copy these pieces of code from the source into your code:

(a) where your form should post to:

<form action="https://yoursite.us19.list-manage.com/subscribe/post" method="POST">  

    <input type="hidden" name="u" value="foo">
    <input type="hidden" name="id" value="bar">

(b) for each field that you want to capture, find the name of the field and paste it as the name into the matching fields on the form you’re updating:

<input type="email" autocapitalize="off" autocorrect="off" name="MERGE0" id="MERGE0" size="25" value="">

(c) form submission details:

<input type="hidden" name="ht" value="foobar"> <input type="hidden" name="mc_signupsource" value="hosted">

If you submit the form and it redirects you to the web form instead of subscribing you to the list, it probably means that you have a name attribute wrong on one of your fields (and when you submitted, Mailchimp didn’t know what to do with that field).

Switching Between Ruby Versions on Windows

I had the need to handle multiple Ruby versions on my Windows PC.  I was creating a new Rails app and wanted to use the latest Ruby version, but I also needed to manage apps that used older versions.  Many developers use RVM, but it doesn’t work on Windows – so I needed a different solution.

I found URU and it works great for managing multiple Ruby versions.

I tried installing it by downloading the compressed file and running the executable included, but it didn’t work correctly.  For some reason, it created a new directory, but the directory was empty.

So instead, I used the Scoop method – downloading Scoop and then using it to install URU.

(1) After I installed URU, I added the directory to my PATH (environmental variable) on my PC.

(2) Next, I opened a CMD window, and then specified the bin directories for each Ruby version you want o use.  For example entering this on the cmd line (for each Ruby install):

uru admin add C:\ruby200\bin

(3) Then to switch between Ruby versions you enter the command, including the Ruby version (without periods):

uru 200

This will switch to Ruby 2.0.0.

You can check that you were switched by entering this command to check what version you are using:

ruby -v

The first time that I did this, I just installed the new Ruby version and I received an error telling me that my gemfile specified version 2.4.4, but I was running 2.2.1.  That was weird because when I ran ‘ruby -v’, it told me I was on 2.4.4.

It turns out, I just needed to run ‘bundle install’ to install the gems that were in the app I was trying to run, but not installed for the new Ruby version yet.

For more details on URU commands, you can read this page from the wiki.

Rails 4.2 Paperclip S3 Tutorial

Getting Paperclip to work on Rails 4.2 while storing files on AWS S3 takes some work on the AWS side, as well as in your app.  Here’s how to do it.

First, prepare S3.

In AWS, go to IAM to create a new user.

ScreenHunter_124 Dec. 13 09.59.jpg

You want to create a user just for your app as opposed to using the master keys for your account so you can limit the access in case someone gets your keys from your app.

Create a new user and enter a name:

ScreenHunter_126 Dec. 13 10.02

After you create the user, you will get this screen.  You will need these keys later, so click the button to download credentials.  Put them somewhere safe because you may need them in the future, too.

ScreenHunter_126 Dec. 13 10.03

Go back to the users view and click on the user

ScreenHunter_126 Dec. 13 10.06

Copy the User ARN value

ScreenHunter_126 Dec. 13 10.07.jpg

Now go to S3.  Create a bucket and note the region you are using.

ScreenHunter_126 Dec. 13 10.09.jpg

Go to the Properties of your Bucket, and click “Add bucket policy”:

ScreenHunter_126 Dec. 13 10.10

Update this code for your User ARN and your bucket name

{
“Version”: “2012-10-17”,
“Statement”: [
{
“Sid”: “”,
“Effect”: “Allow”,
“Principal”: {
“AWS”: “your-user-arn”
},
“Action”: “s3:*”,
“Resource”: [
“arn:aws:s3:::your-bucket-name”,
“arn:aws:s3:::your-bucket-name/*”
]
}
]
}

and paste it in your bucket policy (and save):

ScreenHunter_126 Dec. 13 10.14.jpg

AWS is now set-up.  It’s time to make the changes to your app.

Install the gems in your gemfile:

gem paperclip
gem ‘aws-sdk’

Adjust your models per the examples in Paperclip’s documentation.

Create a s3.yml file in the config folder (you may also want to add this to your .gitignore file to limit the exposure of your keys).  Put your keys from the user there:

development:
access_key_id: “your-access-key”
secret_access_key: “your-secret-access-key”

production:
access_key_id: “your-access-key”
secret_access_key: “your-secret-access-key”

in environments, change the development.rb and production.rb files:

config.paperclip_defaults = {
:storage => :s3,
:bucket => ‘your-bucket-name’,
:region => ‘your-region’
}

Your region name is not the same as the region you put here.  Find your region here.  If your bucket is not in the US, you may have to do additional settings.

Adjust your model:

has_attached_file :image,
:storage => :s3,
:s3_credentials => “#{Rails.root.to_s}/config/s3.yml”,
:s3_protocol => ‘https’,
:url =>’:s3_domain_url’,
:path => ‘/:class/:attachment/:id_partition/:style/:filename’
styles: {
medium: “300×300>”,
thumb: “100×100>” },
default_url: “/images/:style/missing.png”

To show the image in a view:

<%= image_tag @user.image.url(:thumb) %>

 

Select Drop Down in Simple_Form and Rails

I’m using the simple_form gem for forms in Rails and I needed to create a select (drop down) for a field.  In my case, it was for selecting US States, but this can be changed easily to whatever options you want to present by changing the options in the list.

In my user.rb model, I put the options (change these if your select is for something else than US States).

STATES =
[
[‘Alabama’, ‘AL’],
[‘Alaska’, ‘AK’],
[‘Arizona’, ‘AZ’],
[‘Arkansas’, ‘AR’],
[‘California’, ‘CA’],
[‘Colorado’, ‘CO’],
[‘Connecticut’, ‘CT’],
[‘Delaware’, ‘DE’],
[‘District of Columbia’, ‘DC’],
[‘Florida’, ‘FL’],
[‘Georgia’, ‘GA’],
[‘Hawaii’, ‘HI’],
[‘Idaho’, ‘ID’],
[‘Illinois’, ‘IL’],
[‘Indiana’, ‘IN’],
[‘Iowa’, ‘IA’],
[‘Kansas’, ‘KS’],
[‘Kentucky’, ‘KY’],
[‘Louisiana’, ‘LA’],
[‘Maine’, ‘ME’],
[‘Maryland’, ‘MD’],
[‘Massachusetts’, ‘MA’],
[‘Michigan’, ‘MI’],
[‘Minnesota’, ‘MN’],
[‘Mississippi’, ‘MS’],
[‘Missouri’, ‘MO’],
[‘Montana’, ‘MT’],
[‘Nebraska’, ‘NE’],
[‘Nevada’, ‘NV’],
[‘New Hampshire’, ‘NH’],
[‘New Jersey’, ‘NJ’],
[‘New Mexico’, ‘NM’],
[‘New York’, ‘NY’],
[‘North Carolina’, ‘NC’],
[‘North Dakota’, ‘ND’],
[‘Ohio’, ‘OH’],
[‘Oklahoma’, ‘OK’],
[‘Oregon’, ‘OR’],
[‘Pennsylvania’, ‘PA’],
[‘Puerto Rico’, ‘PR’],
[‘Rhode Island’, ‘RI’],
[‘South Carolina’, ‘SC’],
[‘South Dakota’, ‘SD’],
[‘Tennessee’, ‘TN’],
[‘Texas’, ‘TX’],
[‘Utah’, ‘UT’],
[‘Vermont’, ‘VT’],
[‘Virginia’, ‘VA’],
[‘Washington’, ‘WA’],
[‘West Virginia’, ‘WV’],
[‘Wisconsin’, ‘WI’],
[‘Wyoming’, ‘WY’]
]

Now in my simple_form, I put this:

<%= simple_form_for(@user) do |f| %>
<%= f.input :indiv_state, collection: User::STATES %>
<%= f.button :submit %>
<% end %>