Skip to content

Instantly share code, notes, and snippets.

View mcnamee's full-sized avatar

▛▚▞▜ ▞▚ ▜▛ ▜▛ mcnamee

View GitHub Profile
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active December 14, 2023 03:57
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
@mcnamee
mcnamee / prefetch-url.js
Created March 21, 2017 01:36
Prefetch URL on Hover
(function($) {
// Which links should we prefetch?
var $linkElements = $(".menu-item a");
$linkElements.on("hover", function() {
var link = $(this).attr("href"),
prerenderLink = $("#prerenderLink");
if (prerenderLink.length) {
if (prerenderLink.attr("href") === link) return;
prerenderLink.attr("href", link);
@mcnamee
mcnamee / install-mage2.sh
Created April 20, 2018 00:46
Install Magento2, our way
#
#
# Installs Magento2 "the Pivotal Way"
#
# Simply run the following from your CLI:
# `bash <(curl -s <URL TO THE 'RAW' VERSION OF THIS GIST>)`
#
# You get Magento2 installed and the Pivotal Theme
#
# Prereq's: Composer, WP-CLI, Git, Unix
@mcnamee
mcnamee / npm-cloudlinux.md
Last active October 16, 2023 00:40
Install Node / NPM into CloudLinux

How to install Node.js & NPM on CentOS with CloudLinux and CageFS

Add node.js yum repository

yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -

Install node.js and NPM

yum install nodejs

@mcnamee
mcnamee / centos-cpanel-upgrade-node-version.md
Created August 8, 2018 22:30
Upgrade NodeJS on Centos with Cagefs/cPanel

Clean up references to other node version packages

rm -f /etc/yum.repos.d/nodesource-el.repo
yum clean all

Remove Old Node version

@mcnamee
mcnamee / instagram-feed.php
Last active February 11, 2021 08:59
Fetch an Instagram Feed with PHP and Cache it locally
<?php
/**
* Fetches and Caches a Instagram Feed
*
* - Get an Instagram Developer Account here: https://www.instagram.com/developer/
* - Create a new client, using the 'redirect URI' as https://rudrastyh.com/tools/access-token
* - Get an access token here: https://rudrastyh.com/tools/access-token
* - This file will return JSON - so use some AJAX on the front-end to display
* - Add the instagram-feed-cache.json file as ignored, to .gitignore
*/
@mcnamee
mcnamee / phpcs.xml
Last active June 22, 2022 18:55
Wordpress PHPCS Config
<?xml version="1.0"?>
<ruleset name="Pivotal Agency">
<description>Pivotal Wordpress Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
@mcnamee
mcnamee / IAMCredentials.json
Last active February 25, 2019 02:19 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@mcnamee
mcnamee / Multiple Deploy Keys in GitHub.md
Last active February 14, 2023 13:52 — forked from mcfdn/Multiple Deploy Keys in GitHub.md
Using multiple GitHub deploy keys on a single server with a single user

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

@mcnamee
mcnamee / bitbucket-pipelines.yml
Created March 4, 2020 22:51
Ultimate PHP + JS Pipelines Tests
pipelines:
custom:
# PHPCS
# ---------------------------------------------------------------
phpcs:
- step:
image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
caches:
- composer
script: