Skip to content

Instantly share code, notes, and snippets.

View menslow's full-sized avatar

Michael Enslow menslow

View GitHub Profile
@menslow
menslow / WordPress Registration
Created April 13, 2012 00:33
WordPress: Simple registration function for custom front-end registration forms.
/**
* mm_register function.
* Register a new user.
* @access public
* @return User errors or user is logged in.
*/
function mm_register() {
if(!is_user_logged_in()) {
if(!empty($_POST)) {
@menslow
menslow / WordPress Sign In
Created April 12, 2012 21:12
WordPress: Simple sign in function for custom front-end sign in forms.
/**
* mm_sign_in function.
* Sign the user in
* @access public
* @return User errors or true if successful signon
*/
function mm_sign_in() {
if(!is_user_logged_in()) {
if(!empty($_POST)) {
// verify nonce
@menslow
menslow / Cake Cap Deploy
Created April 8, 2012 22:54
CakePHP: Capistrano deployment script for CakePHP App
default_run_options[:pty] = true # Must be set for the password prompt from git to work
set :domain, "your-domain.com"
set :user, "your-user"
set :application, "your-app"
set :repository, "your-repo"
set :branch, "master"
set :scm, :git
# Tell Capistrano to use agent forwarding with this command. uses your local keys instead of keys installed on the server.
@menslow
menslow / wp template part dropdown state
Created February 28, 2012 23:27
WordPress: Template Part: State Dropdown
<?php
global $input_state_province, $input_required, $selected_state;
?>
<label class="unitx1"><?php _e('State'); ?> <?php if($input_required) : echo '*'; endif; ?>
<select id="<?php echo esc_attr($input_state_province); ?>" name="<?php echo esc_attr($input_state_province); ?>" class="<?php if($input_state_province) : echo 'required'; endif; ?>">
<option value=""<?php if($selected_state==='') : echo ' selected="selected"'; endif; ?>><?php _e('Please Select'); ?></option>
<option value="AL"<?php if($selected_state==='AL') : echo ' selected="selected"'; endif; ?>><?php _e('AL'); ?></option>
<option value="AK"<?php if($selected_state==='AK') : echo ' selected="selected"'; endif; ?>><?php _e('AK'); ?></option>
<option value="AZ"<?php if($selected_state==='AZ') : echo ' selected="selected"'; endif; ?>><?php _e('AZ'); ?></option>
<option value="AR"<?php if($selected_state==='AR') : echo ' selected="selected"'; endif; ?>><?php _e('AR'); ?></option>
@menslow
menslow / gist:1855391
Created February 17, 2012 20:55
JavaScript: Boilerplate JavaScript App
App = function(){
/* private */
var default_topic = 'Placeholder Text';
/* HTML5 elememt support tester */
var element_supports_attribute = function(element,attribute){
var test = document.createElement(element);
if (attribute in test) {
return true;