Skip to content

Instantly share code, notes, and snippets.

View evdiv's full-sized avatar

Eugene Dv. evdiv

  • Canada
View GitHub Profile
<?php
// This function prints unique vowels (A, E, I, O, U)
// from a given string in the order they appear.
// A 'Y' is considered a consonant if it begins a string and this string is greater than 1 character.
// Otherwise, a 'Y' is considered a vowel.
function findVowels ($string) {
//Handle 'Y' as a consonant
<?php
class VowelFinder extends Model
{
// This function prints unique vowels (A, E, I, O, U)
// from a given string in the order they appear.
// A 'Y' is considered a consonant if it begins a string and this string is greater than 1 character.
// Otherwise, a 'Y' is considered a vowel.
public function findVowels($string = '') {
@evdiv
evdiv / fizzbuzz.php
Last active September 26, 2017 01:24
<?php
// This function prints the numbers from 1 to 100.
// But, for multiples of three it prints 'Fizz' instead of the number
// And for multiples of five it prints 'Buzz' instead of the number
// But, for numbers which are multiples of both three and five, it only prints 'FizzBuzz'
function generateFizzBuzz() {
$output = '';
<?php
// define the path and name of cached file
$cachefile = 'cached-files/'.date('M-d-Y').'.php';
// define how long we want to keep the file in seconds. I set mine to 5 hours.
$cachetime = 18000;
// Check if the cached file is still fresh. If it is, serve it up and exit.
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
exit;
}
/**
* @name someFunction
* @author
*
* Basic usage:
* someFunction.init();
*
* additionally you can use methods like someFunction.methodName();
*
@evdiv
evdiv / .htaccess
Last active August 26, 2015 00:25 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#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/