Skip to content

Instantly share code, notes, and snippets.

View Joel-James's full-sized avatar
🤸‍♂️
Working + Vacation

Joel James Joel-James

🤸‍♂️
Working + Vacation
View GitHub Profile
@Joel-James
Joel-James / verify-uuid.php
Last active March 6, 2024 22:26
Check if UUID is in valid format
<?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('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', $uuid) !== 1)) {
<!-- 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;
@Joel-James
Joel-James / genesis-sample-full-width-template.php
Created February 19, 2020 09:37
Full width page template for Genesis Sample theme
<?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 January 27, 2020 12:33
PHP - Partial string search in array
<?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
*/
<?php
// Running validation
$this->validate($request, [
'user_id' => 'bail|required|integer|unique:users,user_id'
]);
@Joel-James
Joel-James / registered-sites.php
Last active February 5, 2019 09:57
Get registered sites of a user in WordPress multisite.
<?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 ) {
@Joel-James
Joel-James / jj-startup.sh
Created May 5, 2017 09:00
Startup Actions
#!/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"

#Testing