Skip to content

Instantly share code, notes, and snippets.

View richpeck's full-sized avatar

Richard Peck richpeck

View GitHub Profile
@Shourai
Shourai / namecheap SSL.md
Created October 21, 2017 12:49
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@richpeck
richpeck / default
Last active September 10, 2017 07:20
NGinx Setup
# /etc/nginx/sites-enabled/default
##########################################
##########################################
## General Server Setup ##
##########################################
##########################################
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@richpeck
richpeck / application.rb
Last active August 4, 2018 22:02
CONTROLLER Exception Handling In Rails
# config/application.rb
# This can be put in any of the "environment" files - config/application.rb is just the main
config.exceptions_app = ->(env) { ApplicationController.action(:exception).call(env) }
# If you want custom exceptions, you need to add new rescue_responses:
# http://guides.rubyonrails.org/configuring.html#configuring-action-dispatch
config.action_dispatch.rescue_response["Your::Exception"] = :bad_request
@caalberts
caalberts / .babelrc
Last active January 10, 2020 16:11
React + Webpack + Rails
{
"presets": ["es2015", "react"]
}
@morgyface
morgyface / social.php
Last active April 11, 2024 22:37
WordPress | ACF | Social Media Links using Advanced Custom Fields and FontAwesome
<?php
if( have_rows('social_media', 'option') ):
echo '<div class="container social my-4">';
echo '<p class="follow mb-0 align-middle">Follow us</p>';
echo '<ul class="nav align-middle">';
while ( have_rows('social_media', 'option') ) : the_row();
$socialchannel = get_sub_field('social_channel', 'option');
$socialurl = get_sub_field('social_url', 'option');
echo '<li class="nav-item">';
echo '<a class="nav-link" rel="nofollow noopener noreferrer" href="' . $socialurl . '" target="_blank">';
@opattison
opattison / key_with_multiple_lines_preserved.yaml
Last active February 9, 2022 22:39
How to preserve multiple YAML lines with newlines (for example, to pass through a Markdown filter in Jekyll)
# How to preserve multiple YAML lines with newlines (for example, to pass through a Markdown filter in Jekyll)
# via: http://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines
key: |+
Hello.
World.
# Output if processed with Markdown:
# '<p>hello</p><p>world</p>'
var MGUtil={
data:[],
ini:0,
total:0,
addItem:function(qty,id,properties,callback) {
var params = {quantity:qty,id:id};
if(properties != false){
params.properties = properties;
}
$.ajax({
@quinncomendant
quinncomendant / .htaccess for WP subdirectory installation
Last active September 12, 2022 03:22
This .htaccess file works with Wordpress installed under a subdirectory wp/ inside the document root.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Make the admin still accessible from /wp-admin
RewriteCond %{REQUEST_URI} ^/wp-admin/?(.*)
RewriteRule .* wp/wp-admin/$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^/wp/?$
RewriteRule .* wp/wp-admin/ [L,R=301]
# Base is the URL path of the home directory
RewriteBase /
@waissbluth
waissbluth / _hreflang.html.haml
Last active July 27, 2022 17:57
Ruby on Rails SEO. Add a <link rel="alternate" hreflang="es" href="http://es.example.com/" /> link to every other locale for the same page. Per https://support.google.com/webmasters/answer/189077?hl=en
-# For each locale except the current one
- (I18n.available_locales - [I18n.locale]).each do |locale|
-# Add a link to the current URL but in `locale` language
%link{rel: 'alternate', hreflang: locale, href: url_for(locale: locale)}