How to setup MAMP to use custom .test domains for projects

MAMP is a great development tool for developing locally your web projects. By default, when installing MAMP you have to access your projects in your browser at http://localhost:8888. While this is fine and you can just create folders for each project you’re working at, it might make more sense to setup your projects more like a real world environment, where your project would be at some mywebsite.com.

So when developing locally, we can setup MAMP to have each of your project using a .test TLD. Instead of mywebsite.com it would be mywebsite.test. The first part you only need to do once after you’ve setup MAMP, the second part you’ll have to do for each project you want with a custom domain.

Here’s how to do this:

Download and Install MAMP here: https://www.mamp.info/en/downloads/

Once installed, open MAMP, then select Preferences. Select [Set Web & MySQL ports to 80 & 3306].

Next we need to configure MAMP to use Virtual Hosts.

Within your MAMP installation (often found in Applications), open up this file:

/Applications/MAMP/conf/apache/httpd.conf
Look for these lines of code:
# Virtual hosts
# Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Uncomment out the “Include” line by removing the #.  So it should look like this:

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

We now have MAMP setup for Virtual Hosts. These next steps are repeated every you want to add, update, or delete a project to use a custom .test TLD.

We need to modify two files for each project.  Here’s how to do this:

File 1:

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Append to the bottom of this file the following:

   ServerName mywebsite.test
   DocumentRoot "/Users/amontalbano/git/mywebsite"

You’ll need to update 2 things in here.  First, the ServerName should be the URL that you’d like the local project’s site to be located at and second, the DocumentRoot is the root location of the files for your web project.

Save the file.

File 2: Open up a terminal and type the following:

sudo nano /etc/hosts
(It may prompt you to type in your Mac’s password).

In this file we need to add the following line for our project:

127.0.0.1   mywebsite.test
Make sure the domain with TLD matches exactly to the ServerName you setup in the first file.

Press Control-X, then Y (for Yes), then Enter to save and close the file.

Finally, restart MAMP Servers (Stop Servers, then Start Servers).

Navigate in your browser to mywebsite.test and you’ll see your project in it’s own custom domain with the .test TLD!

Pro Tip: Technically you can use any custom TLD that you like, but I’d advise not use .local.  Often Bonjour on a Mac will use this TLD and may cause conflicts with your MAMP projects.  I use to use .dev, but since the TLD is owned by Google, I switched to .test, given this is a reserved TLD for localhost development.

Happy development!!

How to split data into multiple worksheets by row count in Mac OSX Excel

Based on this tutorial, I was able to split rows into separate Worksheets using Microsoft Excel for Mac.

Here’s what to do:

First highlight all the cells in the Worksheet you want to split into multiple Worksheets.

In Excel, go to Tools > Macro > Visual Basic Editor

In Visual Basic Editor, expand the Microsoft Excel Objects folder and right-click ThisWorkbook, choose Insert, then Module.

Paste the following code into the Module you just created:

Sub SplitData()
Dim WorkRng As Range
Dim xRow As Range
Dim SplitRow As Integer
Dim xWs As Worksheet
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
SplitRow = Application.InputBox("Split Row Num", xTitleId, 5, Type:=1)
Set xWs = WorkRng.Parent
Set xRow = WorkRng.Rows(1)
Application.ScreenUpdating = False
For i = 1 To WorkRng.Rows.Count Step SplitRow
    resizeCount = SplitRow
    If (WorkRng.Rows.Count - xRow.Row + 1) < SplitRow Then resizeCount = WorkRng.Rows.Count - xRow.Row + 1
    xRow.Resize(resizeCount).Copy
    Application.Worksheets.Add after:=Application.Worksheets(Application.Worksheets.Count)
    Application.ActiveSheet.Range("A1").PasteSpecial
    Set xRow = xRow.Offset(SplitRow)
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Click the Run Program icon below the code to run it.

A prompt will ask you to select the cells you’d like to split up (default is what you preselected).  A second prompt will ask you how many rows per sheet.

Depending on the amount of data, it may take some time, but it will split them up into multiple Worksheets.

That’s it!

State and Country abbreviations for Gravity Forms bulk edit drop down field

On a recent project, we needed the values of the Gravity Forms drop down field to be the ISO abbreviations for US states and countries. While we couldn’t find a quick resource, we put together just this one!

 

So next time you’re adding a Gravity Forms drop down field and you need the abbreviation values for states and countries, use the [Bulk Add / Predefined Choices] option and copy and paste the following below:

States

Alabama|AL
Alaska|AK
Arizona|AZ
Arkansas|AR
California|CA
Colorado|CO
Connecticut|CT
District of Columbia|DC
Delaware|DE
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
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

Countries

Afghanistan|AF
Albania|AL
Algeria|DZ
American Samoa|AS
Andorra|AD
Angola|AO
Anguilla|AI
Antarctica|AQ
Antigua &amp; Barbuda|AG
Argentina|AR
Armenia|AM
Aruba|AW
Australia|AU
Austria|AT
Azerbaijan|AZ
Bahama|BS
Bahrain|BH
Bangladesh|BD
Barbados|BB
Belarus|BY
Belgium|BE
Belize|BZ
Benin|BJ
Bermuda|BM
Bhutan|BT
Bolivia|BO
Bosnia and Herzegovina|BA
Botswana|BW
Bouvet Island|BV
Brazil|BR
British Indian Ocean Territory|IO
British Virgin Islands|VG
Brunei Darussalam|BN
Bulgaria|BG
Burkina Faso|BF
Burma (no longer exists)|BU
Burundi|BI
Cambodia|KH
Cameroon|CM
Canada|CA
Cape Verde|CV
Cayman Islands|KY
Central African Republic|CF
Chad|TD
Chile|CL
China|CN
Christmas Island|CX
Cocos (Keeling) Islands|CC
Colombia|CO
Comoros|KM
Congo|CG
Cook Iislands|CK
Costa Rica|CR
Côte D'ivoire (Ivory Coast)|CI
Croatia|HR
Cuba|CU
Cyprus|CY
Czech Republic|CZ
Czechoslovakia (no longer exists)|CS
Democratic Yemen (no longer exists)|YD
Denmark|DK
Djibouti|DJ
Dominica|DM
Dominican Republic|DO
East Timor|TP
Ecuador|EC
Egypt|EG
El Salvador|SV
Equatorial Guinea|GQ
Eritrea|ER
Estonia|EE
Ethiopia|ET
Falkland Islands (Malvinas)|FK
Faroe Islands|FO
Fiji|FJ
Finland|FI
France|FR
France, Metropolitan|FX
French Guiana|GF
French Polynesia|PF
French Southern Territories|TF
Gabon|GA
Gambia|GM
Georgia|GE
German Democratic Republic (no longer exists)|DD
Germany|DE
Ghana|GH
Gibraltar|GI
Greece|GR
Greenland|GL
Grenada|GD
Guadeloupe|GP
Guam|GU
Guatemala|GT
Guinea|GN
Guinea-Bissau|GW
Guyana|GY
Haiti|HT
Heard &amp; McDonald Islands|HM
Honduras|HN
Hong Kong|HK
Hungary|HU
Iceland|IS
India|IN
Indonesia|ID
Iraq|IQ
Ireland|IE
Islamic Republic of Iran|IR
Israel|IL
Italy|IT
Jamaica|JM
Japan|JP
Jordan|JO
Kazakhstan|KZ
Kenya|KE
Kiribati|KI
Korea, Democratic People's Republic of|KP
Korea, Republic of|KR
Kuwait|KW
Kyrgyzstan|KG
Lao People's Democratic Republic|LA
Latvia|LV
Lebanon|LB
Lesotho|LS
Liberia|LR
Libyan Arab Jamahiriya|LY
Liechtenstein|LI
Lithuania|LT
Luxembourg|LU
Macau|MO
Madagascar|MG
Malawi|MW
Malaysia|MY
Maldives|MV
Mali|ML
Malta|MT
Marshall Islands|MH
Martinique|MQ
Mauritania|MR
Mauritius|MU
Mayotte|YT
Mexico|MX
Micronesia|FM
Moldova, Republic of|MD
Monaco|MC
Mongolia|MN
Monserrat|MS
Morocco|MA
Mozambique|MZ
Myanmar|MM
Nambia|NA
Nauru|NR
Nepal|NP
Netherlands|NL
Netherlands Antilles|AN
Neutral Zone (no longer exists)|NT
New Caledonia|NC
New Zealand|NZ
Nicaragua|NI
Niger|NE
Nigeria|NG
Niue|NU
Norfolk Island|NF
Northern Mariana Islands|MP
Norway|NO
Oman|OM
Pakistan|PK
Palau|PW
Panama|PA
Papua New Guinea|PG
Paraguay|PY
Peru|PE
Philippines|PH
Pitcairn|PN
Poland|PL
Portugal|PT
Puerto Rico|PR
Qatar|QA
Réunion|RE
Romania|RO
Russian Federation|RU
Rwanda|RW
Saint Lucia|LC
Samoa|WS
San Marino|SM
Sao Tome &amp; Principe|ST
Saudi Arabia|SA
Senegal|SN
Seychelles|SC
Sierra Leone|SL
Singapore|SG
Slovakia|SK
Slovenia|SI
Solomon Islands|SB
Somalia|SO
South Africa|ZA
South Georgia and the South Sandwich Islands|GS
Spain|ES
Sri Lanka|LK
St. Helena|SH
St. Kitts and Nevis|KN
St. Pierre &amp; Miquelon|PM
St. Vincent &amp; the Grenadines|VC
Sudan|SD
Suriname|SR
Svalbard &amp; Jan Mayen Islands|SJ
Swaziland|SZ
Sweden|SE
Switzerland|CH
Syrian Arab Republic|SY
Taiwan, Province of China|TW
Tajikistan|TJ
Tanzania, United Republic of|TZ
Thailand|TH
Togo|TG
Tokelau|TK
Tonga|TO
Trinidad &amp; Tobago|TT
Tunisia|TN
Turkey|TR
Turkmenistan|TM
Turks &amp; Caicos Islands|TC
Tuvalu|TV
Uganda|UG
Ukraine|UA
Union of Soviet Socialist Republics (no longer exi|SU
United Arab Emirates|AE
United Kingdom (Great Britain)|GB
United States Minor Outlying Islands|UM
United States of America|US
United States Virgin Islands|VI
Unknown or unspecified country|ZZ
Uruguay|UY
Uzbekistan|UZ
Vanuatu|VU
Vatican City State (Holy See)|VA
Venezuela|VE
Viet Nam|VN
Wallis &amp; Futuna Islands|WF
Western Sahara|EH
Yemen|YE
Yugoslavia|YU
Zaire|ZR
Zambia|ZM
Zimbabwe|ZW