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
var decrypt = function (encrypted, method, secret, hmac) { | |
var iv = new Buffer.from(encrypted.substr(0, 24), "base64").toString(); | |
var decryptor = crypto.createDecipheriv(method, secret, iv); | |
return ( | |
decryptor.update(encrypted.substr(24), "base64", "utf8") + | |
decryptor.final("utf8") | |
); | |
}; |
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
var tests = 1000; | |
var i = 0; | |
var t0 = performance.now(); | |
while (i < tests) { | |
functionOne() | |
i++; | |
} | |
var t1 = performance.now(); | |
console.log("Call to test 1 took " + (t1 - t0) + " milliseconds."); |
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 | |
function prefix_get_post_type () { | |
$args = array( | |
'post_type' => 'post_type', | |
'posts_per_page' => 10 | |
); | |
// The Query | |
$the_query = new WP_Query( $args ); | |
// Create empty posts array | |
$posts = array(); |
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
hasOriginalUsername: function() { | |
var illegalChars = new RegExp(/\W/); // allow letters, numbers, and underscores | |
if ( illegalChars.test( this.originalUsername ) ) { | |
return true; | |
} else{ |
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
// Check if user_login already exists before we force update | |
if ( ! username_exists( $username ) ) { | |
// Force update user_login and user_nicename | |
$tablename = $wpdb->prefix . "users"; | |
$wpdb->update( $tablename, // Table to Update ( prefix_users ) | |
array( | |
'user_login' => $username, // Data to Update ( user_login ) | |
'user_nicename' => $username // Data to Update ( user_nicename ) | |
), |
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 | |
$url = 'https://luminous-landscape.com/wp-json/posts?filter[posts_per_page]=4'; | |
get_recent_posts( $url ); | |
function get_recent_posts( $url ) { | |
$json = file_get_contents($url); | |
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 namespace Plugin\Models; | |
use Plugin\Helper; | |
class MemberMapper | |
{ | |
public function sync_members( $post_id ) | |
{ | |
$admins = get_users( array( 'role' => 'administrator', 'fields' => 'ID' ) ); |
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_action( 'genesis_before', 'prefix_remove_entry_header' ); | |
/** | |
* Remove Entry Header | |
*/ | |
function prefix_remove_entry_header() | |
{ | |
if ( ! is_front_page() ) { return; } |
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
*~ | |
.DS_Store | |
.svn | |
.cvs | |
*.bak | |
*.swp | |
Thumbs.db | |
# wordpress specific | |
wp-config.php |
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 and extra class to the entry-content div | |
* | |
*/ | |
function jw_entry_content_class( $attributes ) { | |
if ( is_tax( $taxonomy ) ) | |
$attributes['class'] .= $class_to_add; | |
return $attributes; |
NewerOlder