Skip to content

Instantly share code, notes, and snippets.

🤸‍♂
Working stupidly

Joel James Joel-James

🤸‍♂
Working stupidly
Block or report user

Report or block Joel-James

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Joel-James
Joel-James / genesis-sample-full-width-template.php
Created Feb 19, 2020
Full width page template for Genesis Sample theme
View genesis-sample-full-width-template.php
<?php
/**
* Genesis Sample.
*
* This file adds the full width page template to the Genesis Sample Theme.
*
* Template Name: Full Width
*
* @author StudioPress
* @link https://www.studiopress.com/
@Joel-James
Joel-James / partial-string-search.php
Last active Jan 27, 2020
PHP - Partial string search in array
View partial-string-search.php
<?php
/**
* Helper function to do a partial search for string inside array.
*
* @param array $array Array of strings.
* @param string $keyword Keyword to search.
*
* @return array
*/
@Joel-James
Joel-James / registered-sites.php
Last active Feb 5, 2019
Get registered sites of a user in WordPress multisite.
View registered-sites.php
<?php
/**
* Get user's registered blogs/sites.
*
* @param int|bool $user_id User id or current user.
*
* @return array
*/
public static function get_registered_sites_of_user( $user_id = false ) {
View jj-startup.sh
#!/bin/bash
# Open Google chrome and start with google.com
google-chrome www.google.com
# Open terminal and go to /var/www/html
gnome-terminal --working-directory=/var/www/html
# Open netbeans (Make it last. This will take time).
/bin/sh "/usr/local/netbeans-8.1/bin/netbeans"
View countdown-redirect.html
<!-- Modify this according to your requirement -->
<h3>
Redirecting to duckdev.com after <span id="countdown">10</span> seconds
</h3>
<!-- JavaScript part -->
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
View laravel-bail-example.php
<?php
// Running validation
$this->validate($request, [
'user_id' => 'bail|required|integer|unique:users,user_id'
]);
@Joel-James
Joel-James / verify-uuid.php
Last active Feb 4, 2020
Check if UUID is in valid format
View verify-uuid.php
<?php
/**
* Check if a given string is a valid UUID
*
* @param string $uuid The string to check
* @return boolean
*/
function isValidUuid( $uuid ) {
if (!is_string($uuid) || (preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/', $uuid) !== 1)) {
You can’t perform that action at this time.