Skip to content

Instantly share code, notes, and snippets.

View nickrouty's full-sized avatar

Nick Routsong nickrouty

  • Routy Development LLC
  • Arizona
View GitHub Profile
@nickrouty
nickrouty / example-ion-input-getInputElement.js
Created August 3, 2021 16:42
How to retrieve the native element underlying an IonInput component in React
const passwordInput = useRef<HTMLIonInputElement>(null);
passwordInput.current?.getInputElement().then( (element) => {
if ( element.value ) {
setPassword(element.value);
}
});
@nickrouty
nickrouty / rd-class-text-extraction.php
Created May 9, 2018 04:14
Class for extraction the text from doc, docx, xlsx, pptx and wrapper for 3rd party pdf to text library.
<?php
/**
* Class RD_Text_Extraction
*
* Example usage:
*
* $response = RD_Text_Extraction::convert_to_text($path_to_valid_file);
*
* For PDF text extraction, this class requires the Smalot\PdfParser\Parser class.
@nickrouty
nickrouty / functions.php
Created December 12, 2017 04:07
Filter/Customize the Order number for Chase Paymentech WooCommerce XML API Gateway by Routy Development to append the last 4 numbers of the WooCommerce Order ID.
function rd_set_custom_order_id_for_chase_paymentech( $order_id, $order ) {
return uniqid() . '-' . substr($order->get_id(), -4);
}
add_filter( 'chase_paymentech_gateway_transaction_order_id', 'rd_set_custom_order_id_for_chase_paymentech', 10, 2 );
class ExampleSingleton {
private $properties = array();
private static $instance;
private __construct(){}
public getInstance()
{
if (empty(self::$instance)) {
@nickrouty
nickrouty / palindrom-test.php
Created March 8, 2017 18:34
Palindrome or not?
<?php
$string = "madam";
$array = str_split($string);
$reverse_array = array_reverse( $array, true );
$new_string = implode('', $reverse_array);
echo "<pre>";
var_dump($array, $reverse_array);
echo ( $string === $new_string) ? "Yes, {$string} is a palindrome." : "No, {$string} is not a palindrome.";
@nickrouty
nickrouty / config.xml
Created September 29, 2015 17:03
Example config.xml and index.html meta tag definition for Cordova app to handle Content Security Policy. Learn more: https://github.com/apache/cordova-plugin-whitelist#content-security-policy
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
@nickrouty
nickrouty / install-plugin-whitelist.txt
Created September 29, 2015 16:54
Force installation of Cordova Plugin Whitelist in order to work with Cordova iOS Platform 3.9.1
cordova plugin add cordova-plugin-whitelist@1.0.0
@nickrouty
nickrouty / appname-Info.plist
Created September 29, 2015 16:46
Updating your Apache Cordova app to work with iOS 9 comes with some confusion. We found that we weren't able to make remote requests to API end points that we needed to. To ensure this would work we needed to add the following code to the platforms/ios/[AppName]/appname-Info.plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>ReplaceWithYourDomanName.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
@nickrouty
nickrouty / import_non_existing_media_library_entries.php
Created September 17, 2015 18:23
Import Files into WordPress that aren’t in the Media Library
/*
* This function scans through all files in the wp-content/uploads
* folders and imports them into the media library. This should be
* included in your theme's functions.php file. Simply visit your
* website, including the URL param:
* http://www.example.org/?import_non_existing_media_library_entries=1
*
* Plan on it timing out a few times. Just keep refreshing. It won't
* duplicate files being imported.
*/
<?php
/**
* ACF Layout
* @version 1.0 | November 12th 2013
* @author Beau Charman | http://twitter.com/beaucharman
* @link https://gist.github.com/beaucharman/7181406
* @license MIT license
*
* Logical layout automation for Advanced Custom Fields and it's Flexible Content Field add on.