Skip to content

Instantly share code, notes, and snippets.

View LC43's full-sized avatar
🏄‍♀️
Digital nomad

Pedro de Carvalho LC43

🏄‍♀️
Digital nomad
View GitHub Profile
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@ginpei
ginpei / Gruntfile.js
Created December 17, 2012 02:00
`grunt.loadTasks('foo')` loads all JS files under directory `foo`, not `tasks/foo.js` with grunt v0.4.0rc2.
// ./Gruntfile.js
module.exports = function(grunt) {
grunt.loadTasks('hoge');
};
@danielbachhuber
danielbachhuber / gist:9379135
Created March 5, 2014 23:43
Fix network admin URL to include the "/wp/" base
<?php
/**
* Fix network admin URL to include the "/wp/" base
*
* @see https://core.trac.wordpress.org/ticket/23221
*/
add_filter( 'network_site_url', function( $url, $path, $scheme ){
$urls_to_fix = array(
'/wp-admin/network/',
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 2, 2024 05:49
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@HarishChaudhari
HarishChaudhari / cf7-custom-validation.php
Created November 5, 2014 08:08
Contact Form 7 custom validation
<?php
// Add custom validation for CF7 form fields
function custom_text_validation_filter($result,$tag){
$type = $tag['type'];
$name = $tag['name'];
$the_value = $_POST[$name];
if($name == 'firstname'){
if( empty($the_value) ) {
$result['valid'] = false;
@cgrymala
cgrymala / delete-plugin-tables.php
Created July 10, 2015 14:50
Delete Extra Plugin Tables When a Site Is Deleted in WordPress Multisite
<?php
/**
* Add any custom tables that this plugin creates for an individual site to the list
* of tables that get deleted when a site is deleted.
* @see https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-admin/includes/ms.php#L116
*/
add_filter( 'wpmu_drop_tables', 'delete_my_plugin_tables', 10, 2 );
function delete_my_plugin_tables( $tables=array(), $blog_id=null ) {
/**
* Make sure the blog ID parameter was sent, so we don't
@slushman
slushman / customizer-links.php
Last active September 23, 2023 13:03
How to link into the WordPress Customizer
@chuckreynolds
chuckreynolds / wp-local-media-nginx.txt
Last active October 6, 2023 09:01
Local NGINX WordPress Media Uploads Fallback. Substitute {PROD} for the domain to use images from.
location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp)$ {
try_files $uri @image_fallback;
}
location @image_fallback {
proxy_pass http://{PROD};
}
@v-jacob
v-jacob / Mailhog Bash Script (systemd)
Last active January 9, 2023 08:51
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
anonymous
anonymous / aframe-pan.markdown
Created December 13, 2016 21:22
Aframe pan