Skip to content

Instantly share code, notes, and snippets.

View BRMatt's full-sized avatar

Matt Button BRMatt

View GitHub Profile
<?php
Class Increment extends CodeBench
{
public $description = 'Comparision of $i++ to ++$i';
public $loops = 10000;
public $subjects = array(
// Kinda sporadic jumps, but show a noticeable gap as value increases
<?php
echo 'Yay 2.0';
?>
require 'oauth2'
client = OAuth2::Client.new(
'client_id',
'client_secret',
:site => 'https://workshop.memberful.com',
:authorize_url => '/oauth'
)
redirect_to client.auth_code.authorize_url
SELECT "posts".*, "authors".*
FROM "posts"
LEFT JOIN "authors" ON ("posts"."author_id" = "authors"."author_id");
<?php
add_filter('memberful_wp_after_sign_in_url', 'my_after_sign_in_url');
function my_after_sign_in_url() {
return 'http://gohere.com';
}
<?php
// This will dump information about all plans the currently signed in member has access to
var_dump(memberful_wp_user_plans_subscribed_to(wp_get_current_user()->ID));
// This will print all downloads the currently signed in member has access to, including those granted by a subscription
var_dump(memberful_wp_user_downloads( wp_get_current_user()->ID ));
// You can also pass the id of a specific user to get the plans for that specific user. E.g
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new