This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// source: http://www.paulferrett.com/2009/php-camel-case-functions/ | |
/** | |
* Translates a camel case string into a string with underscores (e.g. firstName -> first_name) | |
* @param string $str String in camel case format | |
* @return string $str Translated into underscore format | |
*/ | |
function from_camel_case($str) { | |
$str[0] = strtolower($str[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't overwrite GNU Midnight Commander's setting of 'ignorespace'. | |
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups | |
# ... or force ignoredups and ignorespace | |
export HISTCONTROL=ignoreboth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# validate nginx config | |
# | |
# depends upon a symbolic link from /var/apps/redirector to dist directory | |
# and a build of nginx which supports real_ip and other extensions | |
# | |
# probably best to build a chroot'd tree containing a complete nginx server | |
# though that's a lot of work to copy in shared libraries, etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sort" | |
"math/rand" | |
"time" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. Copy the file into your repo at `.git/hooks/pre-push` | |
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* How to filter the value that would be returned by get_post_thumbnail_id() | |
*/ | |
add_filter( 'get_post_metadata', function ( $value, $post_id, $meta_key, $single ) { | |
// We want to pass the actual _thumbnail_id into the filter, so requires recursion | |
static $is_recursing = false; | |
// Only filter if we're not recursing and if it is a post thumbnail ID |
OlderNewer