Skip to content

Instantly share code, notes, and snippets.

View AndrewSepic's full-sized avatar

Andrew AndrewSepic

  • Mapbox
  • Earth, for now
View GitHub Profile
@AndrewSepic
AndrewSepic / splitNames.php
Created August 24, 2022 19:06
Take in First Name Last name and return Last Name, First Name Initial
function orderby_lastname ($legislator_name) {
$explodedName = explode(' ', $legislator_name);
if (count($explodedName) == 2) {
$lastNameFirst = array_reverse($explodedName);
$lastNameFirst = implode(' ', $lastNameFirst);
} else {
$lastName = array_pop($explodedName);
array_unshift($explodedName, $lastName);
$lastNameFirst = implode(' ', $explodedName);
}
@AndrewSepic
AndrewSepic / getOrderResult.php
Created November 9, 2021 19:14
Manually created XML for soapVar()
<?php
namespace SoapSapBridge\Server\Action\GetOrder\Nodes;
/**
* Class GetOrdersResult
* @package SoapSapBridge\Server\Model\GetOrdersModel
*/
class GetOrdersResult {
/**
@AndrewSepic
AndrewSepic / linux-commands.trm
Last active October 18, 2021 19:59
My Favourite Linux/Terminal Commands
// Disk Usage
// -h Human readable -dX depth of returned folders /filepath where the du command initiates
du -h -d2 /sites/onsmd
// Remove Directory with Files
rm -rf filname
@AndrewSepic
AndrewSepic / My Favourite GIT commands
Last active August 24, 2024 00:07
A list of my most used git commands for reference
// Create a new branch from the current branch which has uncommitted work
git checkout -b <branch_name>
// Fetch all latest versions of remote & branches
git fetch -all
// Delete a local branch (forces delete with -D rather than -d )
$ git branch -D <local-branch>
// See what files were changed in a commit
@AndrewSepic
AndrewSepic / search.php
Created January 8, 2021 21:07
Search Results template for Prana Framework
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package Prana
*/
get_header(); ?>
<?php
/**
* Template part for displaying the instagram Feed. Dependent upon Smashballoon's instagram feed pro
*
* @link https://www.advancedcustomfields.com/resources/flexible-content/
*
* @package Prana
*/
// settings
<?php
/**
* Template part for displaying the 50/50 Module
*
* @link https://www.advancedcustomfields.com/resources/flexible-content/
*
* @package Prana
*/
// settings
<?php
//Check that the user is logged in/ has been verified and has cookies set
if ( isset( $_COOKIE['isAuthorized'] ) ){
$current_user = $_COOKIE['clientName'];
echo '<p>Welcome ' . $current_user . ' | <a class="mboLogOut" href="#">Logout</a></p>';
?>
<script>
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
# Scout Multi-site specific
wp-content/plugins/
<script>
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});