Skip to content

Instantly share code, notes, and snippets.

View MarkBolden's full-sized avatar
🎯
Focusing

Mark Bolden MarkBolden

🎯
Focusing
View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@chrisjlee
chrisjlee / media-queries.scss
Last active January 6, 2024 12:36
All Media Queries breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@jefferyrdavis
jefferyrdavis / gist:5992271
Last active December 4, 2020 07:16
Snippit: PHP: Format 10 or 7 digit phone number
<?php
/* formats a 10 or 7 digit phone number (number only) by adding dashes at the appropriate locations */
function phoneFormat($number) {
if(ctype_digit($number) && strlen($number) == 10) {
$number = substr($number, 0, 3) .'-'. substr($number, 3, 3) .'-'. substr($number, 6);
} else {
if(ctype_digit($number) && strlen($number) == 7) {
$number = substr($number, 0, 3) .'-'. substr($number, 3, 4);
}
@maor
maor / ninja-forms-countries-dd.php
Last active March 27, 2019 03:10
Ninja Forms countries dropdown select field
<?php
/**
* Add a new <select> field, pre-populated with all countries in our tiny, tiny world.
*
* @author Maor Chasen
*/
function aff_register_ninja_forms_fields() {
$args = array(
@nixta
nixta / .htaccess
Last active March 19, 2024 22:52
.htaccess to add CORS to your website
# Add these three lines to CORSify your server for everyone.
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
@lukescott
lukescott / gist:36453a75c39c539f5c7d
Last active February 12, 2024 00:00
Traits in ES6 now
/*
var Trait1 = {
method1() {}
};
var Trait2 = {
method2() {}
};
var Trait3 = mixin({
@tomysmile
tomysmile / vagrant-shortcut.md
Last active December 17, 2019 19:47
Vagrant: Shortcut command

Creating initial vagrant file

$ vagrant init

Running precise32

$ vagrant init hashicorp/precise32
@PowerKiKi
PowerKiKi / generate-wildcard-certificate.sh
Created December 4, 2015 07:31
Generate self-signed wildcard SSL certificate for development environment
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 domain.lan"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate for given domain."
echo "This should only be used in a development environment."
@contemplate
contemplate / functions.php
Last active November 14, 2023 12:59
WooCommerce - Allow guest checkout for certain products when Guest checkout is Disabled globally
/*--------------------------------------
Woocommerce - Allow Guest Checkout on Certain products
----------------------------------------*/
// Display Guest Checkout Field
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
@gcphost
gcphost / pretty-php-numbers.php
Last active October 26, 2021 08:40
Pretty PHP Numbers, convert a number to K, M, B, etc.
<?php
function human_number($number) {
$number = preg_replace('/[^\d]+/', '', $number);
if (!is_numeric($number)) {
return 0;
}
if ($number < 1000) {