Skip to content

Instantly share code, notes, and snippets.

Avatar

Joey Kudish jkudish

View GitHub Profile
@jkudish
jkudish / dusk.sh
Created Mar 28, 2017
How I run dusk on Codeship
View dusk.sh
export DUSK_START_CHROMEDRIVER=false
export DUSK_APP_PORT=8000
export DUSK_CHROME_BINARY=/usr/bin/chromium-browser
nohup bash -c "./vendor/laravel/dusk/bin/chromedriver-linux 2>&1 &"
nohup bash -c "php artisan serve --env=dusk.testing 2>&1 &" && sleep 4
php artisan dusk
View revisedscript.php
<?php
require_once dirname( __FILE__ ) . '/wp-load.php';
//$existing_image = 'http://guidevoyage.org.dev' . '/wp-content/uploads/2010/12/122010_0314_LamdinadeSo1.png';
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $full_image_url ){
global $wpdb;
View getIDfromGUID.php
<?php
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $existing_image ){
global $wpdb;
return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=attachment AND guid=%s", $existing_image ) );
}
$existing_image = "http://guidevoyage.org.dev/wp-content/uploads/2012/02/Fontaine-de-Trevi.jpg";
@jkudish
jkudish / displaylink-installer-.sh
Created Aug 13, 2015
displaylink-installer.sh modified for Fedora 22
View displaylink-installer-.sh
@jkudish
jkudish / gist:6498978
Created Sep 9, 2013
Flynn's Site Redesign
View gist:6498978
<!DOCTYPE html>
<html>
<head>
<title>Flynn O'connor - Ginger Magic</title>
</head>
<body>
<img src="http://images.bluegartr.com/bucket/gallery/b2cd73a5be2f61e788add2d3cb6e8839.jpg" alt="Ginger Magic">
</body>
</html>
View chilpages-looping.php
<?php
/**
* Notes and things that I changed:
* -- fixed indentation and spacing for WP standards
* -- posts_per_page = -1 is dangerous, what happens if the site has 1000000 posts, the server will explode - find a high but sane limit
*/
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
View gist:5896965
I searched for the following
<dc:creator><![CDATA[:)]]></dc:creator>
and replaced with the following:
<dc:creator><![CDATA[mymoltenshield]]></dc:creator>
@jkudish
jkudish / singleton-example.php
Last active Dec 16, 2015
This is an example of a singleton
View singleton-example.php
<?php
My_Class {
private static $instance;
public static function instance() {
if ( isset( self::$instance ) )
return self::$instance;
View gist:4969000
Index: wp-admin/nav-menus.php
===================================================================
--- wp-admin/nav-menus.php (revision 23446)
+++ wp-admin/nav-menus.php (working copy)
@@ -264,6 +264,8 @@
// Get existing menu locations assignments
$locations = get_registered_nav_menus();
$menu_locations = get_nav_menu_locations();
+ if ( empty( $menu_locations ) || ! is_array( $menu_locations ) )
+ $menu_locations = array();
View emailshortcode.php
<?php
// Hide Email from Spam Bots
function cwc_mail_shortcode( $atts , $content = null ) {
if ( ! is_email( $content ) )
return;
for ( $i = 0; $i < strlen( $content ); $i++ )
$encodedmail .= "&#" . ord( $content[$i] ) . ';';
return '<a href="' . esc_url( 'mailto:' . $encodedmail ) . '">Email</a>';