Skip to content

Instantly share code, notes, and snippets.

View smededwards's full-sized avatar

Michael Edwards smededwards

View GitHub Profile
@bgallagh3r
bgallagh3r / wp.sh
Last active May 31, 2025 20:57
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@james2doyle
james2doyle / getBrowser.php
Last active February 20, 2024 06:06
a PHP function to sniff the user agent of the browser and return a nice object with all the information
<?php
// http://www.php.net/manual/en/function.get-browser.php#101125
function getBrowser() {
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
// First get the platform?
if (preg_match('/linux/i', $u_agent)) {
@ryansechrest
ryansechrest / php-style-guide.md
Last active June 26, 2025 10:05
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@mariovalney
mariovalney / bitbucket-pipelines.yml
Last active April 8, 2021 13:39
Deploying from Bitbucket Pipelines to WP Engine using Gulp
image: node:10.9.0
pipelines:
custom:
production:
- step:
deployment: production
caches:
- node
script:
// FLEXBOX CSS GRID
// by Laptev Pavel
// VARiABLES
// desktop grid
$grid-desktop-columns: 12;
$grid-desktop-sideMargin: 80px;
$grid-desktop-gutter: 40px;
$grid-desktop-breakpoint: 1400px;
@SimonPadbury
SimonPadbury / scss-color-palette-generator.scss
Last active July 15, 2024 21:43
SCSS color palette generator — use to generate a range of color utilities (text color, background, border-color).
// Example: Set your color variables
$color--gray: #888888;
$color--blue: #3366FF;
$color--teal: #43E7F9;
$color--green: #5BD642;
$color--orange: #ffae18;
$color--red: #FF4732;
// Example: Set a color shade step interval
@resource11
resource11 / Accessible-smooth-scrolling
Last active December 10, 2023 17:04
A CSS snippet for leveraging a smooth scroll behavior in an accessible manner
/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
@scottjehl
scottjehl / whichones.js
Created August 21, 2020 15:40
which elements are wider than the viewport?
var list = [];
document.querySelectorAll("body *")
.forEach(function(elem){
if(elem.getBoundingClientRect().width > document.body.getBoundingClientRect().width){
list.push(elem.outerHTML.split('>')[0] + '>');
}
});
confirm( "these elements are wider than the viewport:\n\n " + list.join("\n") )
@hhhonzik
hhhonzik / deploy.yml
Last active March 27, 2025 14:28
Kinsta Deployment
# Kinsta Deployment through Github Actions for Bedrock/Sage.
#
# Placed at: .github/workflow/deploy.yml
#
# Process should be studied from code, but some quick brief:
# - runs composer / sage installation
# - moves correct `.env.*` file for multiple configs
# - uses rsync to sync files, uses /.rsyncignore file to exclude whatever should not be there
# - symlinks uploads folder and symlink release folder to kinsta public hostname
# - if you want to clear cache, please uncomment the last job