Skip to content

Instantly share code, notes, and snippets.

View versluis's full-sized avatar

Jay Versluis versluis

View GitHub Profile
@versluis
versluis / YouTube.prg
Created March 23, 2018 11:39
Create random YouTube URLs in Commodore BASIC
10 print chr$(14)
20 gosub 100:x=rnd(-ti):cn=1
30 a$="https://youtu.be/"
40 for i=1 to 11
50 rn=int(rnd(0)*62)+1
60 a$=a$+yt$(rn)
70 next
80 print:print cn;" : ";a$
85 cn=cn+1
90 goto 30
@versluis
versluis / gist:3645165878facd7473b8e6ab569e4121
Created February 19, 2018 15:36
List all posts in WordPress
// list all articles on this site
// https://codex.wordpress.org/Template_Tags/wp_get_archives
$args = array(
'type' => 'postbypost',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
@versluis
versluis / denominations.py
Created November 5, 2016 21:51
denominations.py
# Calculate denominations in dollars, quarters, dimes and cents from a starting sum (in cents)
print('---------------')
amount = 439
print('Total: ', amount)
dollars =(amount-amount%100)/100
amount -=dollars*100
quarters = (amount-amount%25)/25
@versluis
versluis / checkForAlex.m
Last active July 22, 2016 22:43
Checks if the Alex voice is installed on iOS.
- (void)checkForAlex {
// is Alex installed?
BOOL alexInstalled = NO;
NSArray *voices = [AVSpeechSynthesisVoice speechVoices];
for (id voiceName in voices) {
if ([[voiceName valueForKey:@"name"] isEqualToString:@"Alex"]) {
alexInstalled = YES;
@versluis
versluis / gist:7615113
Last active December 29, 2015 04:29 — forked from leovandriel/gist:3923434
Preloading Images in iOS
// ImagePreloadingViewController - An iOS view controller for trying out different
// UIImage preloading strategies. Results for 1 MB png on iPhone 4S:
// - No preload: drawing the image right away (80 ms)
// - Header preload: getting the width (10 ms) and then drawing (100 ms)
// - Data preload: getting the data (110 ms) and then drawing (75 ms)
// - Draw preload: drawing it once (100 ms) and then again (20 ms)
// In short: preload a UIImage by drawing it.
// License: BSD
// Author: Leonard van Driel, 2012
@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,
@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 / 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 / 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 / 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');