Skip to content

Instantly share code, notes, and snippets.

@alicial
alicial / amz-s3-bucket-policy
Created September 13, 2012 18:26
Amazon S3 Bucket Policy to prevent hot linking
{
"Version": "2008-10-17",
"Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@bueltge
bueltge / add-blog-id.php
Created October 4, 2012 09:51
View Blog and User ID in WordPress Multisite
<?php
/**
* Plugin Name: Add Blog and User ID on Network
* Plugin URI: http://wpengineer.com/2188/view-blog-id-in-wordpress-multisite/
* Description: View Blog and User ID in WordPress Multisite
* Version: 1.0.0
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv3
*/
@markjaquith
markjaquith / plugin-deploy.sh
Created November 16, 2012 05:04 — forked from scribu/plugin-deploy.sh
Plugin deploy script
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
@imath
imath / bp-customize-registration.php
Created December 16, 2012 18:11
This is a BuddyPress gist. Using it in your active theme will allow you to manage a regular WordPress user meta in the registration form. Just above the profile fields form, you'll see a new text input 'Usermeta'. You can customize the different references to a random user meta i used (bp_cr_usermeta) by your own.
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
/****
You should paste this into a file (in the example below : bp-customize-registration.php )
in your active theme's folder, then depending if your theme is a child theme or not you should
use this code in your functions.php to include the trick
@bitfade
bitfade / gist:4555047
Last active January 21, 2022 03:06
WordPress - Remove empty p tags for custom shortcodes
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@bradpotter
bradpotter / enqueue fitvids
Last active December 11, 2015 18:19
Enqueue fitvids from https://github.com/davatron5000/FitVids.js | Props to @realFATmedia & @krogsgard
// Add to functions file
add_action('wp_enqueue_scripts', 'child_javascript_files');
function child_javascript_files() {
wp_register_script( 'fitvids', get_stylesheet_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), '1.0', true );
wp_register_script( 'loadfitvids', get_stylesheet_directory_uri() . '/js/load.fitvids.js', array('fitvids'), '1.0', true );
wp_enqueue_script( 'fitvids' );
wp_enqueue_script( 'loadfitvids' );
}
@Blackshawk
Blackshawk / blog - Explaining My Choices Further.md
Last active April 25, 2023 19:31
In which I do a little digging about the choices I've made with PHP. This is a long read, but it isn't something that can be explained in one or two paragraphs.

In the comments from my last post and on Twitter I noticed a lot of people who had something to say about PHP. The comments were varied but they usally sounded something like this (sorry @ipetepete, I picked yours because it was the shortest).

...the little bits of soul from all of us who've had to work on, and or maintain large PHP applications. – ipetepete

In Pete's defense, he did go on to say that rest of the stack I was using was a "smorgasbord of awesome". Thanks, Pete. I agree!

I would, however, like to take a little time to correct a misperception in the developer community about PHP. I recently got into this same... discussion... with Jeff Atwood, and I seem to be running into it more and more. So here goes. Please bear with me as I cover a little history further on.

Pete, and everybody else, _you're exactly rig

@boogah
boogah / .htaccess
Created April 12, 2013 16:49
A list of bad IPs responsible for a number of brute force attacks on WordPress, prepared as an .htaccess deny list. Just add it to your site's .htaccess rules and feel a tiny bit safer. List culled from this post by Sucuri: http://blog.sucuri.net/2013/04/mass-wordpress-brute-force-attacks-myth-or-reality.html
# BEGIN wp-login.php blocks
<Files wp-login.php>
order allow,deny
deny from 31.184.238.38
deny from 178.151.216.53
deny from 91.224.160.143
deny from 195.128.126.6
deny from 85.114.133.118
deny from 177.125.184.8
deny from 89.233.216.203
@kingkool68
kingkool68 / Seamless Git Deployment
Last active December 17, 2015 05:09
To push code changes to text servers I do this.
We have a private Git running on a server somewhere which we consider our central repository. Inside the .git/hooks/post-recieve is the following:
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
@surefirewebserv
surefirewebserv / simple-social-centered.css
Last active August 31, 2023 15:51
Center Simple Social Icons when doing responsive styles
/* Align Simple Social Icons Centered */
.simple-social-icons ul.alignright,
.simple-social-icon ul.alignleft {
text-align: center;
}
.simple-social-icons ul.alignright li,
.simple-social-icons ul.alignleft li {
display: inline-block;
float: none;