Skip to content

Instantly share code, notes, and snippets.

View versluis's full-sized avatar

Jay Versluis versluis

View GitHub Profile
@versluis
versluis / alertView.m
Created August 1, 2012 17:36
How to react to a UIAlertView
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
[self myMethod];
if (buttonIndex ==0) {
NSLog(@"User pressed first button");
} else if (buttonIndex == 1) {
NSLog(@"User pressed second button");
} else {
NSLog(@"There were even more buttons?");
@versluis
versluis / custom.xml
Created September 27, 2012 17:53
Default MySQL Heatlh Configration
<!-- after -->
<service name="MySql" monitor="true">
<alarm level="red" threshold="50" type="percent"/>
<alarm level="yellow" threshold="40" type="percent"/>
</service>
@versluis
versluis / backBtn.js
Last active December 11, 2015 11:09
How to bring back the "back" button in jquery mobile. Call this before linking the jquery mobile library in your fie.
<script type="text/javascript">
// adding a back button
$(document).bind("mobileinit",function() {$.mobile.page.prototype.options.addBackBtn = true; });
</script>
@versluis
versluis / ajax.php
Last active December 14, 2015 11:58
This code adds category posting back into P2
// define $post_cat
$post_cat = $_POST['post_format'];
// and turn it into the category ID
$post_cat = get_category_by_slug( $post_cat );
$post_id = wp_insert_post( array(
'post_author' => $user_id,
'post_title' => $post_title,
'post_content' => $post_content,
'post_type' => 'post',
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@versluis
versluis / gist:6464723
Created September 6, 2013 14:37
Remove unwanted widgets from the WordPress Dashboard. Copy into your theme's functions.php file.
//Remove unwanted widgets from Dashboard
function remove_dashboard_widgets() {
global$wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
@versluis
versluis / jQuery.php
Created September 25, 2013 05:00
How to load jQuery in WordPress
<script type="text/javascript">
jQuery(document).ready(function($) {
// your code here, for example
$("yourid").fadeIn(2000);
});
</script>
@versluis
versluis / index.html
Created October 4, 2013 13:00
How to (re-) enable the Default Back Button in jQuery Mobile
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery Mobile Web App</title>
<!-- link jQuery Mobile styles -->
<link href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/>
<!-- load jQuery -->
@versluis
versluis / index.html
Last active December 24, 2015 16:29
PhoneGap Starter Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- tells the device browser not make phone numbers clickable -->
<meta name="format-detection" content="telephone-no">
<!-- several things are going on here:
- first we'll make sure the user can't pinch or zoom
@versluis
versluis / post-form.php
Created October 8, 2013 13:49
adding categories to P2
<select name="drop_cat" id="drop_cat">
<option value=""><?php echo esc_attr(__('Select a Category', 'p2' )); ?></option>
<?php
$args = array (
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,