Skip to content

Instantly share code, notes, and snippets.

View giovanniramos's full-sized avatar
🖥️
Work Work Work

Giovanni Ramos giovanniramos

🖥️
Work Work Work
View GitHub Profile
@giovanniramos
giovanniramos / createColsOf.php
Created January 7, 2011 20:35
Function that generates a list, with their surround option, by columns argument.
<?php
/**
* createColsOf ()
*
* Function that generates a list, with their surround option, by columns argument.
*
* @author Giovanni Ramos
* @todo add more options.
*
* @param array $vars
@giovanniramos
giovanniramos / gist:907912
Created April 7, 2011 14:50
This function converts a full name for UTF-8 ignoring certain prepositions.
<?php
/**
* getFullName ()
*
* This function converts a full name for UTF-8 ignoring certain prepositions.
*
* @author Giovanni Ramos
*
* @param string $fullName
* @return string
@giovanniramos
giovanniramos / gist:1478921
Last active September 28, 2015 18:27
Makes converting with date/datetime (BR <=> U.S.)
<?php
/**
* Makes converting with date/datetime (BR <=> U.S.)
*
* @param string $value The date or datetime
* @param string $type Format types: datetime, date, time
* @return string
*
* */
function swapDatetime($value, $type = 'datetime')
@giovanniramos
giovanniramos / gist:1483817
Last active September 28, 2015 19:08
Converts a string. Useful functions in slug
<?php
/**
* Converts a string. Useful functions in slug
*
* @param string $string The input string
* @param string $mode OPTIONAL Conversion Formats: Lower (Everything to lowercase), Upper (Everything to uppercase)
* @return string
*
* */
function normalize($string, $mode = null)
@giovanniramos
giovanniramos / gist:1542587
Last active September 29, 2015 03:48
Checks if a value exists in an array
<?php
/**
* Checks if a value exists in an array
*
* @param mixed $needle The value sought
* @param array $haystack The array that will be verified
* @return boolean
*
* */
function in_multiarray($needle, $haystack)
@giovanniramos
giovanniramos / gist:1542593
Last active September 29, 2015 03:48
Checks through recursion, a list of keys that have a value EMPTY or NULL
<?php
/**
* Checks through recursion, a list of keys that have a value EMPTY or NULL
*
* @param array $haystack A simple/multi-dimensional array
* @param string $mandatory List with the names of keys that will be checked, separated by commas
* @return boolean
*
* */
function is_arrayEmpty($haystack, $mandatory = null)
@giovanniramos
giovanniramos / LICENSE.txt
Created March 7, 2012 03:16 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@giovanniramos
giovanniramos / gist:3078188
Last active October 7, 2015 00:38
Removes the style markup in html tags, derived from a text editor
<?php
/**
* Removes the style markup in html tags, derived from a text editor
*
* @param string $value The input string
* @return string
* @link https://gist.github.com/3078188
*
* */
function clearStyle($value)
@giovanniramos
giovanniramos / gist:3100679
Last active October 7, 2015 03:48
Returns the sum of occurrences, in an array of a given condition satisfied
<?php
/**
* Returns the sum of occurrences, in an array of a given condition satisfied
*
* @param mixed $value The value or array to be evaluated
* @param string $operator Operator of evaluation
* @param string $conditional Conditional assignment
* @return integer
* @link https://gist.github.com/3100679
*
@giovanniramos
giovanniramos / gist:3190455
Created July 27, 2012 20:58
get_called_class < 5.3 [solution]
<?php
/**
* get_called_class < 5.3 [solution]
*
*/
function get_called_class()
{
$objects = array();
$traces = debug_backtrace();