Skip to content

Instantly share code, notes, and snippets.

Joseph Spurrier josephspurrier

Block or report user

Report or block josephspurrier

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
@josephspurrier
josephspurrier / index.php
Last active Aug 29, 2015
WordPress Disconnected from Themes
View index.php
<?php
/**
* Model for interfacing with a Wordpress backend
*
* @author Alex Crooks, Si digital http://sidigital.co
**/
// Just replace your WordPress index.php content with this code to test.
define('APP_PATH', dirname( __FILE__ ));
@josephspurrier
josephspurrier / disable_wordpress_editor_cleanup.php
Last active Aug 29, 2015
Disable the WordPress Editor Cleanup
View disable_wordpress_editor_cleanup.php
/**
* Disable the Visual and Text Editor p and br tag modifications when saving
*
* When you call the editor, it will automatically add a filter depending
* on which editor you have open:
* * Text Editor: add_filter('the_editor_content', 'wp_htmledit_pre');
* * Visual Editor: add_filter('the_editor_content', 'wp_richedit_pre');
*
* The only way to stop this is to remove the filter because it's applied.
* The next call after is do_action( 'media_buttons', $editor_id );
@josephspurrier
josephspurrier / centerbackground.htm
Last active Aug 29, 2015
Center a Background Image on a Webpage
View centerbackground.htm
<!DOCTYPE html>
<html lang="en" style="overflow: auto; height: 100%;">
<body style="background: #222222; margin: 0; height: 100%;">
<div style="overflow: hidden; height: 100%;">
<img id="background-image" src="https://www.gstatic.com/chat/hangouts/bg/a432eb7bf6eef1cccf7946ca20e5c2c0-NeilKremer.jpg">
</div>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
@josephspurrier
josephspurrier / array_vs_slice.go
Created Dec 22, 2014
Golang - Differences between Array and Slice
View array_vs_slice.go
package main
import (
"fmt"
"reflect"
"strings"
)
func main() {
// Arrays, slices (and strings)
@josephspurrier
josephspurrier / aescmd.go
Created Dec 23, 2014
Golang - Encrypt, Decrypt, File Read, File Write, Readline
View aescmd.go
package main
import (
"bufio"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
@josephspurrier
josephspurrier / drop_encrypt.go
Last active Aug 8, 2019
Golang - Drag and Drop AES Encryption and Decryption
View drop_encrypt.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@josephspurrier
josephspurrier / values_pointers.go
Last active Sep 14, 2019
Golang - Asterisk and Ampersand Cheatsheet
View values_pointers.go
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@josephspurrier
josephspurrier / structs_interface.go
Last active Sep 7, 2019
Golang - Understand Structs and Interfaces
View structs_interface.go
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@josephspurrier
josephspurrier / spinner.go
Last active Nov 19, 2017
Golang - Spinner
View spinner.go
package main
import (
"fmt"
"time"
)
func main() {
// Make a channel for the spinner
@josephspurrier
josephspurrier / bitmask.go
Created Feb 1, 2015
Golang - Determine if bitmask is set
View bitmask.go
/*
fmt.Println(Bitmask(0x6).IsSet(0x2))
fmt.Println(Bitmask(f.FileHeader.Characteristics).ListDescriptions(charValues))
fmt.Println(Bitmask(f.FileHeader.Characteristics).ListValues(charValues))
*/
type Bitmask uint16
// BitValue is a value and a description
type BitValue struct {
You can’t perform that action at this time.