Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # <-- wordpress owner
WP_GROUP=changeme # <-- wordpress group
WP_ROOT=/home/changeme # <-- wordpress root directory
@vancouverwill
vancouverwill / gist:6517187
Created September 10, 2013 23:28
blend two colours in PHP
/**
*
* $color1 - hexdecimal color 1 without the hash at the beginning e.g. ffffff
* $color2 - hexdecimal color 1 without the hash at the beginning e.g. 000000
* $ratio - ration between the two colors as a fraction of 1 e.g. for 65% use 0.65
*
**/
function mix_colors_blend($color1, $color2, $ratio = 0.5) {
$color1_red = hexdec(substr($color1, 0, 2));
@vancouverwill
vancouverwill / gist:6513983
Created September 10, 2013 18:58
resizable content area to fit to screen size when scrolling down page or page being resized
function setContainerHeightToPage(container, heightFromTop)
{
var gridHeight = jQuery(window).height() + jQuery(document).scrollTop() - heightFromTop;
$(container).css('height', gridHeight + 'px');
}
function intializeSetContainerHeightToPage( container, heightFromTop)
{
setContainerHeightToPage( container, heightFromTop);
@vancouverwill
vancouverwill / gist:5647118
Last active December 17, 2015 17:39
multi level interval boolean check with timeout
function successFunction() {
console.log('begin nike button');
}
function failFunction() {
console.log('shit hit the fan');
}
@vancouverwill
vancouverwill / gist:5646673
Last active December 17, 2015 17:29
javascript limited time interval using loop
function setTimedOutInterval(totalTime, intervalTime, callBackFunction) {
var noOfLoops = totalTime / intervalTime,
counter = 0;
intervalId = setInterval(function () {
console.log('check');
console.log(counter);
if (counter <= noOfLoops) {
counter++;
} else {
clearInterval(intervalId);
@vancouverwill
vancouverwill / gist:5646661
Created May 24, 2013 21:32
javascript limited time interval using timeout
function setTimedOutInterval(totalTime, intervalTime, callBackFunction) {
intervalId = setInterval(function () {
console.log('check B');
if (finished === true) {
console.log('B finished = true');
clearInterval(intervalId);
callBackFunction();
}
}, intervalTime);