Skip to content

Instantly share code, notes, and snippets.

View mmenavas's full-sized avatar

Maximo Mena mmenavas

  • SemanticBits
  • Phoenix, Arizona, USA
View GitHub Profile
@mmenavas
mmenavas / non_iso_dates.csv
Created April 26, 2021 17:56
Sample CSV with non ISO dates
NPI Specialty Optout End Date Eligible to Order and Refer
1003865486 Nurse Practitioner March 17 2021 Y
1003924556 Oral Surgery February 16 2022 Y
1003933953 Dermatology June 19 2020 Y
1003943325 Dermatology September 09 2021 Y
1003960378 Psychiatry July 26 2021 Y
1003963455 Psychiatry October 27 2021 Y
1003965963 Oral Surgery December 02 2021 Y
1013001593 Psychiatry April 11 2021 Y
1013327246 Psychiatry August 20 2020 Y
@mmenavas
mmenavas / field_group_form_validation
Created July 16, 2020 19:46
This snippet expands the details tags whenever a child form field fails browser validation
(function ($, Drupal) {
Drupal.behaviors.openRequiredWrappers = {
attach: function (context, settings) {
// Prevent unnecessary multiple reloads.
if (context instanceof HTMLDocument) {
console.log("Test WDDSE-1913");
var required_items = $('input,textarea,select').filter('[required]');
@mmenavas
mmenavas / xdebug.ini
Last active April 5, 2019 20:59
xDebug in Docker for Mac
[xdebug]
zend_extension=xdebug.so
xdebug.idekey = PHPSTORM
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host=host.docker.internal
@mmenavas
mmenavas / config
Last active August 24, 2018 07:20
This file allows your system to recognize multiple ssh key files
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/pantheon
IdentityFile ~/.ssh/platform
@mmenavas
mmenavas / .travis.yml
Created August 13, 2018 04:36
Travis CI file for custom Drupal 8 module
language: php
php:
- '7.2'
env:
global:
- MODULE_NAME='example'
- SIMPLETEST_BASE_URL='http://127.0.0.1:8080'
# Ignore Symfony's deprecation notices.
@mmenavas
mmenavas / .lando.yml
Last active February 2, 2018 19:54
Research Academy Lando files
name: research-academy
recipe: drupal7
config:
webroot: .
php: '5.6'
xdebug: true
services:
appserver:
build:
- "mkdir -p ~/.drush/site-aliases"
@mmenavas
mmenavas / Rectangle.php
Last active September 27, 2017 07:22
PHP class that allows you to draw a rectangle on the command line.
<?php
class rectangle {
public function __construct($size, $width = 0, $height = 0) {
$sizes = $this->getSizes();
if (isset($sizes[$size])) {
$this->width = $sizes[$size]['width'];
$this->height = $sizes[$size]['height'];
@mmenavas
mmenavas / PrimeNumbers.php
Last active January 6, 2019 23:46
Prime Numbers
<?php
// This utility class provides a function that calculates all prime numbers up to a given number.
// Disclaimer: Depending on your system, you may not want to find prime numbers greater than 10000 as
// this operation can take several minutes if not hours.
class PrimeNumbers {
public static function getPrimeNumbers($ceiling) {
@mmenavas
mmenavas / gen-d8-salt.sh
Created July 24, 2017 20:37 — forked from pfaocle/gen-d8-salt.sh
Generate Drupal 8 hash salt
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))"
<?php
$users = array(
'username1',
'username2',
);
foreach ($users as $username) {
$user = user_load_by_name($username);
$role = user_role_load_by_name("event coordinator");