Skip to content

Instantly share code, notes, and snippets.

View versluis's full-sized avatar

Jay Versluis versluis

View GitHub Profile
@versluis
versluis / isThisInThat.php
Created March 19, 2019 15:19
helper function to test if a string is contained in another string
function isThisInThat ($needle, $haystack) {
return strpos($haystack, $needle) !==false;
}
@versluis
versluis / vanish.html
Last active April 10, 2019 22:35
Make empty links disappear from the DOM
<p class="one"><a href=''>This line shall vanish.</a></p>
<p class="one"><a href='https://versluis.com'>This line shall prevail.</a></p>
<p>The End.</p>
<script>
// make empty links vanish
$('.one a').each(function() {
if(!$(this).attr('href')) {
$(this).parent().hide();
@versluis
versluis / functions.php
Created May 23, 2019 15:17
generated by Child Theme Wizard 1.4
function your_theme_enqueue_styles() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style,
get_template_directory_uri() . '/style.css');
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array($parent_style),
yum history
Loaded plugins: fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
86 | root <root> | 2019-07-12 11:13 | I, O, U | 11 EE
85 | root <root> | 2019-07-12 11:09 | Install | 1
84 | root <root> | 2019-07-12 10:43 | E, I, U | 19 EE
83 | root <root> | 2019-05-06 08:59 | E, I, U | 27 EE
82 | root <root> | 2018-12-19 22:41 | Update | 2
@versluis
versluis / yum history undo
Created July 12, 2019 15:40
yum history undo - Dependencies Resolved
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php-mysql i686 5.4.45-56.el6.art atomic 461 k
Removing:
gd-last i686 2.2.5-5.el6.remi @remi-safe 372 k
libargon2 i686 20161029-7.el6.remi @remi-safe 58 k
@versluis
versluis / functions.php
Created July 25, 2019 13:30
adds file upload capabilities to the Contributor Role in WordPress
// add file uploads to Contributor role
function add_uploads_to_contribs () {
global $pagenow;
// grab contribtor role
$role = get_role ('contributor');
// if this theme is activated, add the upload capability
if ('themes.php' == $pagenow && isset ($_GET['activated'])) {
$role -> add_cap ('upload_files');
@versluis
versluis / functions.php
Created August 14, 2019 13:49
make Gutenberg Galleries link to Media File by default
// make galleries link to Media File
// https://wordpress.stackexchange.com/questions/115368/overide-gallery-default-link-to-settings
function make_galleries_link_to_file() {
$post_type_object = get_post_type_object( 'post' );
$post_type_object->template = array(
array( 'core/gallery', array(
'linkTo' => 'media',
) ),
);
}
@versluis
versluis / category.php
Last active November 15, 2019 05:12
How to extract the Category Title without a URL
// print the categry title without a link
foreach((get_the_category()) as $category){
echo '<h1 class="page-title">' . $category->name . '</h1>';
}
// print the category description
the_archive_description('<blockquote class="wp-block-quote">', '</blockquote>');
@versluis
versluis / webError.m
Created August 1, 2012 16:24
How to handle an error while loading a UIWebView
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
[self.spinningWheel stopAnimating];
UIApplication *application = [UIApplication sharedApplication];
application.networkActivityIndicatorVisible = NO;
UIAlertView *infoMessage;
infoMessage = [[UIAlertView alloc]
initWithTitle:@"The internet is broken" message:@"Looks like there's a problem with your internet connection. Please check and try again later."
delegate:self cancelButtonTitle:@"Bloody technology!" otherButtonTitles:nil];
@versluis
versluis / WordPress-Login-Logo.php
Last active August 26, 2020 15:20
Changing your WordPress Login Logo
// add my own Login Logo
function guru_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/your-logo.png);
height:65px;
width:320px;
background-size: 320px 65px;
background-repeat: no-repeat;
padding-bottom: 10px;