This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"composer/installers": "^1.6" | |
}, | |
"require-dev": { | |
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", | |
"wp-coding-standards/wpcs": "^2.0" | |
}, | |
"scripts": { | |
"php:lint": "composer install && vendor/bin/phpcs -p" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'themename_twbs_bootstrap_defaults', 'themename_twbs_bootstrap_defaults' ); | |
function themename_twbs_bootstrap_defaults( $defaults ) { | |
$defaults['version'] = '3.3.7'; | |
$defaults['files'] = 'both'; | |
$defaults['cdn'] = 'maxcdn'; | |
$defaults['css_path'] = get_theme_file_uri( 'assets/css' ); | |
$defaults['js_path'] = get_theme_file_uri( 'assets/js' ); | |
return $defaults; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE images ( | |
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
post_id bigint(20) unsigned NOT NULL DEFAULT '0', | |
image longtext, | |
PRIMARY KEY (meta_id), | |
KEY post_id (post_id) | |
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; | |
INSERT INTO images (post_id, image) VALUES (2,'image1.jpg'),(2,'image2.jpg'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Uploads tests. | |
*/ | |
if ( $_POST && isset( $_POST['upload'] ) && ! empty( $_FILES ) ) { | |
/** Define ABSPATH as this file's directory */ | |
if ( ! defined( 'ABSPATH' ) ) { | |
define( 'ABSPATH', dirname( __FILE__ ) . '/' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Extract full name to first and last name. | |
* | |
* @version 1.0.1 | |
* @link https://gist.github.com/camaleaun/a9ab8de21dd9830708f927b6db69c021 | |
* @param string $name Full name. | |
* @param string $object Optional. If true return as OBJECT (with 'first' and 'last' as properties) (Default ARRAY_N). | |
* @return array|object First and last names. | |
*/ | |
function pluginname_split_name( $name, $object = false ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
WP_CLI::add_hook( 'after_wp_load', 'pluginname_cli_runner' ); | |
} | |
function pluginname_test() { | |
WP_CLI::success( 'Command works.' ); | |
} | |
function pluginname_cli_runner() { | |
WP_CLI::add_command( 'pluginname test', 'pluginname_test' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rand() { | |
RANGE=$2 | |
rand=$RANDOM | |
let "rand %= $RANGE" | |
} | |
generate_password() { | |
chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lte IE 8]> | |
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script> | |
<![endif]--> | |
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script> | |
<script> | |
hbspt.forms.create({ | |
portalId: "PORTAL_ID_HERE", | |
formId: "FORM_ID_HERE" | |
}); | |
var chatData = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'short_aliases' ); | |
add_filter( 'short_aliases', 'shorts_redirect' ) ); | |
function short_aliases() { | |
$aliases = apply_filters( 'short_aliases', array() ); | |
if ( ! is_array( $aliases ) ) { | |
$aliases = array(); | |
} | |
foreach ( $aliases as $alias => $redirects ) { | |
add_rewrite_rule( "^$alias/?", $redirects, 'top' ); |