Skip to content

Instantly share code, notes, and snippets.

View sean-gilmore's full-sized avatar
🥦

Sean sean-gilmore

🥦
View GitHub Profile
@sean-gilmore
sean-gilmore / colors.sh
Last active March 12, 2023 00:10
Display terminal colour configuration
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
@sean-gilmore
sean-gilmore / .jsbeautifyrc
Created November 26, 2020 23:17
JS Beautify config for PHP Intelliphense for VSCode
{
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"end-with-newline": true,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"keep_array_indentation": false,
@sean-gilmore
sean-gilmore / create-dir-in-uploads.php
Created October 6, 2020 23:50
Create new directory in wp-content/uploads
// will result in a path of `wp-content/uploads/new_folder_in_uploads/`
$directory = $uploads['basedir'] . '/new_folder_in_uploads/';
if (!file_exists($directory)) {
wp_mkdir_p($directory);
}
@sean-gilmore
sean-gilmore / get-query-params.js
Created May 28, 2019 03:21
Vanilla.js Query String parse
function getQueryParams() {
var qd = {};
if (location.search) {
location.search.substr(1).split("&").forEach(function(item) {
var s = item.split("="),
k = s[0],
v = s[1] && decodeURIComponent(s[1]);
(qd[k] = qd[k] || []).push(v)
})
<p class="body--lead">This is some test lead text.</p>
<hr />
<p>OK, so images can get quite complicated as we have a few variables to work with! For example the image below has had a caption entered in the WordPress image upload dialog box, this creates a [caption] shortcode which then in turn wraps the whole thing in a <code>div</code> with inline styling! Maybe one day they'll be able to use the <code>figure</code> and <code>figcaption</code> elements for all this. Additionally, images can be wrapped in links which, if you're using anything other than <code>color</code> or <code>text-decoration</code> to style your links can be problematic.</p>
<div id="attachment_28" class="wp-caption alignnone" style="width: 510px"><a href="#"><img src="http://www.wpfill.me.s3-website-us-east-1.amazonaws.com/img/img_large.png" alt="Your Alt Tag" title="bmxisbest" width="500" height="300" class="size-large wp-image-28"></a><p class="wp-caption-text">This is the optional caption.</p></div>
<p>The next issue we face is imag
@sean-gilmore
sean-gilmore / froala.js
Created April 8, 2019 03:54
Froala Editor Wrapper
$.FroalaEditor.DefineIcon('alert', {NAME: 'info'});
$.FroalaEditor.RegisterCommand('alert', {
title: 'Hello',
focus: false,
undo: false,
refreshAfterCallback: false,
callback: function () {
alert('Hello!');
}
});
@sean-gilmore
sean-gilmore / breakpoints-and-z-index.scss
Last active January 20, 2021 23:42
Breakpoints and Z-Index Variables
// https://semantic-ui.com/elements/container.html - breakpoints
$extra-large-monitor-max: 1300px;
$large-monitor-min: 1200px;
$large-monitor-max: 1199px;
$small-monitor-min: 992px;
$small-monitor-max: 991px;
$tablet-min: 768px;
$tablet-max: 767px;
$mobile-min: 436px;
$mobile-max: 435px;
@sean-gilmore
sean-gilmore / wordpress.gitignore
Created December 27, 2018 03:38
Recommended WordPress .gitignore
*.log
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/mu-plugins/
wp-content/wp-cache-config.php
@sean-gilmore
sean-gilmore / extensions.md
Created July 30, 2018 07:06
Sean's recommended vscode extensions

Sean's recommended vscode extensions

General

  • Bookmarks
  • Bracket Pair Colorizer
  • Advanced New File
  • Code Spell Checker
  • File Utils
  • file-icons
  • Git Blame
@sean-gilmore
sean-gilmore / wp-config.php
Created January 30, 2018 00:07
Fix Question mark characters appearing in text
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');