Skip to content

Instantly share code, notes, and snippets.

/**
* Display the post excerpt.
*
* @since 0.71
*/
function the_excerpt() {
/**
* Filters the displayed post excerpt.
*
@bwmarkle
bwmarkle / sample.js
Created August 28, 2018 16:53
How to add a notice in the Customizer
// Create.
var notification = new wp.customize.Notification(
'my_id',
{
dismissible: true,
message: '<p>Message goes here.</p>',
type: 'success'
}
);
@bwmarkle
bwmarkle / class-boldgrid-backup-premium-admin-historical.php
Last active October 25, 2018 19:02
Fatal error: Uncaught Error: Call to undefined function wp_generate_password()
<?php
// THIS IS THE ORIGINAL LINE, CAUSING THE PROBLEM:
$this->dir = Boldgrid_Backup_Admin_Utility::trailingslashit( $backup_dir ) . $base_dir . wp_generate_password( 16, false );
// THIS IS THE FIX TO THE PROBLEM:
// Please see: https://github.com/BoldGrid/boldgrid-backup/issues/9
// Full path: boldgrid-backup/admin/remote/class-boldgrid-backup-admin-ftp.php
public function is_setup( $try_cache = false ) {
// ## #############################
// STEP ONE: COMMENT OUT THIS LOGIC
// ## #############################
// If successfully logged in within last 24 hours, return true.
//if ( $try_cache && $this->settings->is_last_login_valid() ) {
Code examples used in https://youtu.be/cUeV3S7NGcU
# How to specify your error_log file
ini_set( "error_log", "/home/user/error_log.txt" );
---
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "2.8.31",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "64fa4b07f056e338a5f0f29eece75babaa83af68"
},
"dist": {
Add this:
```php
wp_insert_user( array(
'user_email' => $userinfo->email,
'first_name' => $userinfo->givenName,
'last_name' => $userinfo->familyName,
'role' => 'author',
'user_pass' => md5( $userinfo->email . time() ),
'user_login' => explode( '@', $userinfo->email )[0],
public class Foo {
public void setPassword(String password) {
if (password.length() > 7) {
throw new InvalidArgumentException("password");
}
}
}
public class Foo {
public static final int MAX_PASSWORD_SIZE = 7;
public void setPassword(String password) {
if (password.length() > MAX_PASSWORD_SIZE) {
throw new InvalidArgumentException("password");
}
}
}
for i from 1 to 52
j := i + randomInt(53 - i) - 1
a.swapEntries(i, j)