Skip to content

Instantly share code, notes, and snippets.

@jorenvh
jorenvh / gist:3568bbb3f535b0cc0e985e71d4ad827e
Created December 9, 2023 14:51
GrumPHP config example
parameters:
grumphp.ignore_patterns:
- '*/vendor'
- 'bin'
- 'custom/plugins'
- 'public'
- 'tests'
- 'var'
- 'src/Command'
@jorenvh
jorenvh / .htaccess
Created July 24, 2017 13:05
Htacces to combine Laravel & Angular in one project. Angular is used for the front & Laravel as an API for Angular
# URL rewrite
<IfModule mod_rewrite.c>
RewriteEngine on
# Redirect www
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# rewrite to laravel
@jorenvh
jorenvh / slack.py
Last active February 23, 2017 14:16
Bulk remove files from Slack
import requests
import json
import calendar
import argparse
from datetime import datetime, timedelta
parser = argparse.ArgumentParser()
parser.add_argument("token")
args = parser.parse_args()
@jorenvh
jorenvh / functions.php
Created January 12, 2017 15:37
Update custom taxonomy field for ACF plugin to recognise existing terms on existing posts
<?php
add_action('init', 'td_add_special_terms_of_existing_posts_to_custom_field');
function td_add_special_terms_of_existing_posts_to_custom_field()
{
$postTypes = ['post', 'external_urls', 'videos'];
$custom_query_args = array(
'post_type' => $postTypes,
'posts_per_page' => -1,
'orderby' => 'post_date_gmt',
@jorenvh
jorenvh / debug-windows-azure-blob-storage-plugin.php
Created December 21, 2016 09:37
Debug output Windows Azure blob storage plugin
[21-Dec-2016 09:28:18 UTC] Array
(
[0] => Array
(
[file] => /Applications/MAMP/htdocs/project/dev/wp-includes/plugin.php
[line] => 235
[function] => windows_azure_storage_wp_update_attachment_metadata
[args] => Array
(
[0] => Array
@jorenvh
jorenvh / functions.php
Created December 19, 2016 10:43
WP filters & actions (support windows azure WP plugin)
<?php
/*
|--------------------------------------------------------------------------
| Actions
|--------------------------------------------------------------------------
|
| Wordpress add_action functions.
|
|
@jorenvh
jorenvh / VerifySlacktoken.php
Created July 4, 2016 18:55
Slack slash commands middleware for Laravel
<?php // app/Http/Middleware/VerifySlackToken
namespace App\Http\Middleware;
use Closure;
use Exception;
use Illuminate\Contracts\Config\Repository;
class VerifySlackToken
{
php artisan migrate:rollback --step=1
@jorenvh
jorenvh / homestead-extras.sh
Created October 30, 2015 19:29
Laravel homestead extras
#!/bin/bash
apt-get update
#Additional Packages
apt-get install -y cifs-utils winbind smbclient bindfs gvfs gvfs-bin keyutils unzip php5-ldap php5-mssql zsh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
chsh vagrant -s /bin/zsh