Skip to content

Instantly share code, notes, and snippets.

View neo22s's full-sized avatar

Chema neo22s

View GitHub Profile
@neo22s
neo22s / phpMyDB
Created November 22, 2010 19:26
Mysql Object with cache integrated
<?php
/*
* Name: phpMyDB
* URL: http://neo22s.com/phpmydb/
* Version: v1.1
* Date: 21/11/2010
* Author: Chema Garrido
* License: GPL v3
* Notes: Mysql Object with cache integrated
@neo22s
neo22s / bbcode.php
Created May 3, 2012 08:55
BBcode parser example
<?php
/**
* BBcode helper class
*
* @package BBcode
* @category Helper
* @author Chema <chema@garridodiaz.com>
* @copyright (c) 2012
* @license GPL v3
*/
@neo22s
neo22s / seoreport.php
Created August 19, 2012 08:59
seo report php
<?php
/**
*
* SEO report for different metrics
*
* @category SEO
* @author Chema <chema@garridodiaz.com>
* @copyright (c) 2009-2012 Open Classifieds Team
* @license GPL v3
* Based on seo report script http://www.phpeasycode.com && PHP class SEOstats
@neo22s
neo22s / captha.php
Created October 2, 2012 09:07
ultra light captcha
<?php
/**
* ultra light captcha class
*
* @package Open Classifieds
* @subpackage Core
* @category Helper
* @author Chema Garrido <chema@garridodiaz.com>
* @license GPL v3
@neo22s
neo22s / example.php
Created February 12, 2013 10:23
remodel, PHP models for redis
<?php
//main class to extend usage
require 'remodel.php';
//loading library predis: https://github.com/nrk/predis
require 'predis-0.8/autoload.php';
Predis\Autoloader::register();
///MODEL EXAMPLE
class Model_Post extends Remodel {
@neo22s
neo22s / example.php
Created February 12, 2013 10:38
You know Range from PHP? so this function does same but with given dates ;)
//normal
$dates = date_range(strtotime('-1 month'), time());
//advanced, using all parameters
$dates = date_range(strtotime('-1 month'), time(),'+1 day','Y-m-d',array('date'=>0,'count'=> 0),'date');
/**
* get an array range with dates in a specific format
* @param string $start from
* @param string $end to
@neo22s
neo22s / embed.js
Created December 21, 2013 11:55
Modal open iframe with external URI
function getElementsByClassName(node, classname) {
if (node.getElementsByClassName) {
return node.getElementsByClassName(classname);
} else {
return (function getElementsByClass(searchClass, node) {
if (node == null)
node = document;
var classElements = [],
els = node.getElementsByTagName("*"),
elsLen = els.length,
@neo22s
neo22s / seo.php
Created February 21, 2014 09:48
<?php
/**
* Class to improve the seo of the site
*
* @package OC
* @category SEO
* @author Chema <chema@open-classifieds.com>
* @version 1.0
* @date 21-02-2014
* @url http://garridodiaz.com/phpseo/
@neo22s
neo22s / formatcurrency.php
Created March 18, 2014 14:41
NumberFormatter formatCurrency alternative
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
function formatcurrency($floatcurr, $curr = 'USD')
{
/**
* A list of the ISO 4217 currency codes with symbol,format and symbol order
@neo22s
neo22s / loadingbar.js
Created June 17, 2014 16:07
loading bar.js
//from https://github.com/peachananr/loading-bar
//I have recoded it a bit since uses a loop each, which is not convenient for me at all
$(function(){
$("a.ajax-load").click(function(e){
e.preventDefault();
button = $(this);
//get the link location that was clicked
pageurl = button.attr('href');
//to get the ajax content and display in div with id 'content'