Skip to content

Instantly share code, notes, and snippets.

Daron Daronspence

Block or report user

Report or block Daronspence

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Daronspence
Daronspence / .htaccess-redirect
Created Aug 2, 2016
Same HTTPS .htaccess Redirect
View .htaccess-redirect
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]
View user-info-widget.php
<?php
// Put this inside of the widget template file for ACFW
// You could also just add this stuff to the template file for your sidebar. Same thing essentially :)
// Note, none of this has been tested! You have been warned! :)
$department = get_user_meta('fire_department', wp_get_current_user()->ID );
$federal_id = get_user_meta('federal_id', wp_get_current_user()->ID );
@Daronspence
Daronspence / Custom-Taxonomy-Meta-Box.php
Last active Feb 11, 2016
Add code to custom taxonomy meta boxes
View Custom-Taxonomy-Meta-Box.php
<?php
register_taxonomy( 'acme_custom_taxonomy', array( 'my_cpt', 'post' ), array(
'meta_box_cb' => 'acme_metabox_cb',
) );
function acme_metabox_cb( $post, $box ){
// Render the default hierarchical meta box form
post_categories_meta_box( $post, $box );
@Daronspence
Daronspence / pagination.php
Created Jan 27, 2016
WordPress Pagination Bar (1,2,3,4,...,87,88)
View pagination.php
<?php
function pagination_bar() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo paginate_links(array(
View submit-ssl-working.php
<?php
// https://github.com/daverogers/serverpilot-php
require_once('serverpilot-php/lib/ServerPilot.php');
$clientid = "cid_XXXXXXXXX";
$apikey = "XXXXXXXXXXXXXX";
$appid = "XXXXXXXXXX";
$priv = trim(file_get_contents('/etc/letsencrypt/live/DOMAINNAME/privkey.pem'));
$cert = trim(file_get_contents('/etc/letsencrypt/live/DOMAINNAME/fullchain.pem'));
@Daronspence
Daronspence / showpassword.js
Last active Dec 14, 2015
Show Password for Active Field
View showpassword.js
(
function(){
document.activeElement.setAttribute('type', 'text');
}
)();
// Encoded // javascript:(function()%7Bdocument.activeElement.setAttribute('type'%2C 'text')%7D)()
View advent-of-code-day-4-part-2.js
// Crypto JS MD5 library was used. https://code.google.com/p/crypto-js/#MD5
var CryptoJS = require('./md5');
var MD5 = CryptoJS.Crypto.MD5;
var input = 'ckczppom';
var adventCoin = 0;
@Daronspence
Daronspence / advent-of-code-day-4-part-1.js
Last active Dec 9, 2015
Advent of Code - Day 4 Solution
View advent-of-code-day-4-part-1.js
// Crypto JS MD5 library was used. https://code.google.com/p/crypto-js/#MD5
var CryptoJS = require('./md5');
var MD5 = CryptoJS.Crypto.MD5;
var input = 'ckczppom';
var adventCoin = 0;
@Daronspence
Daronspence / custom-button.php
Created Sep 21, 2015
Custom button for WordPress post editor
View custom-button.php
<?php
// Callback function to insert 'styleselect' into the $buttons array
function prefix_mce_buttons( $buttons ) {
array_unshift( $buttons, 'styleselect' );
//var_dump($buttons);
return $buttons;
}
// Register our callback to the appropriate filter
// _2 places the new button on the second line
@Daronspence
Daronspence / payload-filter.php
Last active Aug 29, 2015
wpMandrill $payload Filter
View payload-filter.php
<?php
# You'll need PHP 5.3+ to run this code as is. http://php.net/manual/en/functions.anonymous.php
// This action fires for an ajax event. Change it to whatever hook you need.
add_action( 'wp_ajax_todo_invite_friend', function(){
// We're only going to apply the filter when this specific action is triggered
add_filter( 'mandrill_payload', function( $payload ){
You can’t perform that action at this time.