This file contains hidden or 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 | |
/* | |
I was faced with a problem where I had to cycle through a list of HTML colors and I thought this was | |
a nice way of doing it. As array_shift returns the value you remove at the front, simply appending it | |
to the array does the business. I thought I would share it in-case someone finds it useful. | |
*/ | |
# We need a list of colors for grouping purposes | |
$colors = array( |
This file contains hidden or 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 | |
# Define the days of the week | |
$days = array( | |
'Friday', | |
'Saturday', | |
'Sunday', | |
'Monday', | |
'Tuesday', | |
'Wednesday', |
This file contains hidden or 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 | |
# Let's define a simple array to display the function | |
$array = array("How", "Now", "Brown", "Cow", "With", "The", "Brown", "Fox"); | |
# Check if it contains a duplicate value? | |
if ( count($array) !== count(array_unique($array)) ) | |
{ | |
echo "Contains Duplicate"; | |
} |
This file contains hidden or 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 | |
# Author: Rudi Strydom | |
# Date: Aug 2013 | |
# Purpose: Building a quick and dirty table class. To transform an array to a table | |
class Table | |
{ | |
public $table_attributes = array(); | |
public $table_heading = array(); |
This file contains hidden or 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
#!/usr/bin/python | |
import os | |
def findNremove(path,pattern,maxdepth=1): | |
cpath=path.count(os.sep) | |
for r,d,f in os.walk(path): | |
if r.count(os.sep) - cpath <maxdepth: | |
for files in f: | |
#print files | |
if files == pattern: |
This file contains hidden or 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
<html> | |
<head> | |
<style> | |
#passwordContainer | |
{ | |
line-height: 30px; | |
font-size: 30px; | |
} |
This file contains hidden or 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
#!/usr/bin/php | |
<?php | |
# This function will be used to get the information from the inbound SMS | |
function decode($string) | |
{ | |
# Split the text into lines | |
$lines = explode("\n", $string); |
This file contains hidden or 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 | |
# Function to determine the average luminance of an image | |
function image_avg_luminance($filename, $num_samples=10, $section="all") | |
{ | |
# Variables required | |
$img = imagecreatefromjpeg($filename); | |
$width = imagesx($img); | |
$height = imagesy($img); |
This file contains hidden or 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 | |
# Function to determine the average luminance of an image | |
function image_avg_luminance($filename, $num_samples=10, $section="all") | |
{ | |
# Variables required | |
$img = imagecreatefromjpeg($filename); | |
$width = imagesx($img); | |
$height = imagesy($img); | |
$x_step = intval($width/$num_samples); |
This file contains hidden or 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 | |
# DATA | |
$data_url = "http://rudi.strydom.photography/Portfolio/json/rand"; | |
$get_data = file_get_contents($data_url); | |
# Geckoboard specifics | |
$gb_url = "https://push.geckoboard.com/v1/send/"; | |
$gb_token = ""; | |
$gb_api_key = ""; |
OlderNewer