Skip to content

Instantly share code, notes, and snippets.

View mdunbavan's full-sized avatar

Mark Dunbavan mdunbavan

View GitHub Profile
@mdunbavan
mdunbavan / beautiful.rest.api.docs.in.markdown.md
Created June 19, 2023 09:45 — forked from azagniotov/beautiful.rest.api.docs.in.markdown.md
Example to create beautiful REST API docs in Markdown, inspired by Swagger API docs.
@mdunbavan
mdunbavan / GitCommitEmoji.md
Created September 14, 2022 09:31 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@mdunbavan
mdunbavan / google_cloud_storage_craft_3.md
Created July 8, 2021 11:19 — forked from croxton/google_cloud_storage_craft_3.md
How to provision Google Cloud Storage buckets for Craft CMS 3.x

Create the bucket

  1. Open the console https://console.cloud.google.com
  2. If you haven't already, setup your Cloud billing account
  3. From the drop down at the top of the screen, create new project for your client, e.g. my-client
  4. Make a note of the Project number on the project Home screen (Craft refers to this as the Project ID)
  5. In the sidebar go to APIs & Services > Credentials, click the + Create credentials button and choose the Service Account type
  • Set account name to craft-cms or similar
  • Set role to Owner
  • Save
  1. Click on the newly created service account email to edit it, then click the Keys tab and click Add key > Create new key and select the JSON format
@mdunbavan
mdunbavan / component.js
Created October 8, 2019 09:20 — forked from nathanlogan/component.js
Emulate URL anchor page scroll functionality in a React component
import React, { Component } from 'react'
class MyTopLevelComponent extends Component {
componentDidMount () {
this.scrollToHashId()
}
componentDidUpdate () {
this.scrollToHashId()
}
@mdunbavan
mdunbavan / gist:499d398e92973200df903a23c5f6eda6
Created November 24, 2017 17:59 — forked from bradwestfall/gist:f5a010e96fb0c4d18556
Pull Instagram Images via JavaScript
@mdunbavan
mdunbavan / webpack.mix.js
Created November 21, 2017 14:49 — forked from andrewdelprete/webpack.mix.js
Laravel Mix: Tailwind CSS + PurgeCSS Example
let mix = require("laravel-mix");
let tailwindcss = require("tailwindcss");
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@mdunbavan
mdunbavan / README.md
Created June 20, 2017 09:26 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@mdunbavan
mdunbavan / jquery-device-detect
Created April 7, 2017 10:26 — forked from dubrod/jquery-device-detect
jQuery Device Detect via User Agent
//touch/mobile detection
if (
navigator.userAgent.match(/Phone/i) ||
navigator.userAgent.match(/DROID/i) ||
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/) ||
navigator.userAgent.match(/Windows Phone/i) ||
@mdunbavan
mdunbavan / craft-localization-nginx
Created September 21, 2016 15:17 — forked from cmalven/craft-localization-nginx
nginx config for Craft CMS localization
server {
listen 80;
server_name site.production.designcompany.com;
root /home/forge/site.production.designcompany.com/public;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript image/svg+xml text/xml text/css;
<form id="contact" name="contact" method="post">
<fieldset>
<label for="name" id="name">Name<span class="required">*</span></label>
<input type="text" name="name" id="name" size="30" value="" required/>
<label for="email" id="email">Email<span class="required">*</span></label>
<input type="text" name="email" id="email" size="30" value="" required/>
<label for="phone" id="phone">Phone</label>
<input type="text" name="phone" id="phone" size="30" value="" />