Skip to content

Instantly share code, notes, and snippets.

{
"name": "company/wp-unit-tests",
"type": "wordpress-plugin",
"require": {
"phpunit/phpunit": "~5.0.6"
},
"autoload": {
"psr-4": {"company\\Tests\\": "src/"},
"files": ["src/functions.php"]
}
@fulippo
fulippo / gist:7486b1c5fe7683831b0a
Created March 21, 2016 10:56
Retrieve config from AWS during deploy
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
@fulippo
fulippo / .htaccess
Last active September 9, 2016 13:50
Htaccess and php file to debug system variables
RewriteEngine On
RewriteBase /
RewriteRule .* - [E=INFO_API_VERSION:%{API_VERSION},NE]
RewriteRule .* - [E=INFO_AUTH_TYPE:%{AUTH_TYPE},NE]
RewriteRule .* - [E=INFO_CONTENT_LENGTH:%{CONTENT_LENGTH},NE]
RewriteRule .* - [E=INFO_CONTENT_TYPE:%{CONTENT_TYPE},NE]
RewriteRule .* - [E=INFO_DOCUMENT_ROOT:%{DOCUMENT_ROOT},NE]
RewriteRule .* - [E=INFO_GATEWAY_INTERFACE:%{GATEWAY_INTERFACE},NE]
RewriteRule .* - [E=INFO_HTTPS:%{HTTPS},NE]
RewriteRule .* - [E=INFO_HTTP_ACCEPT:%{HTTP_ACCEPT},NE]
@fulippo
fulippo / functions.php
Created June 1, 2018 14:46
Fix Gravity Forms Captcha
// This action should be inside add_actions
/**
* Remove Gravityforms captcha action
* This is a fix to prevent interferences from commonLib.js
*/
add_action('get_footer', function(){
global $wp_filter;
foreach($wp_filter['wp_footer']->callbacks as $priority => $hooks){
foreach($hooks as $k => $hook){
@fulippo
fulippo / leaders.py
Last active August 23, 2019 10:10
Find leaders in array
#!/usr/bin/env python
numbers = [16, 17, 4, 3, 5, 2]
leaders = []
for i, n in enumerate(numbers):
remaining = numbers[i+1:]
if len(remaining) == 0 or n > max(remaining):
leaders.append(n)