Skip to content

Instantly share code, notes, and snippets.

@Cezarion
Cezarion / Collection.php
Created November 25, 2013 10:00
Object Collections in PHP
<?php
/**
* @author : Aaron Fisher
* @link :http://www.aaron-fisher.com/articles/web/php/object-collections-in-php/
*/
class Collection
{
protected $objects; // array
@Cezarion
Cezarion / css_resources.md
Last active December 29, 2015 07:49 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.
  • Stitches An HTML5 sprite sheet generator
@Cezarion
Cezarion / javascript_resources.md
Created November 25, 2013 09:59 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@Cezarion
Cezarion / wtf.php
Last active December 29, 2015 07:49
A little debugging function
<?php
/*
Seriously, wtf?
@link : https://gist.github.com/7639026
@author : aaron fisher
*/
function wtf($var, $arrayOfObjectsToHide=array(), $fontSize=11)
{
$text = print_r($var, true);
@Cezarion
Cezarion / validate_email.php
Last active December 28, 2015 18:49
Email validation
<?php
function validEmail($email)
{
$isValid = true;
$atIndex = strrpos($email, "@");
if (is_bool($atIndex) && !$atIndex)
{
$isValid = false;
}
else
@Cezarion
Cezarion / php_session_expire.php
Created November 19, 2013 14:04
Make expirable session variables
<?php
/**
* Return false if session variable is no longer valid otherwise return the value that
* the session variable holds.
*
* @param string $name Session variable name
* @return bool|mixed true if var has expired otherwise return the value of the variable
*/
function getSessionVar($name)
@Cezarion
Cezarion / array_to_object.php
Created November 19, 2013 14:03
Cast a multidimensional array to a stdClass object.
<?php
/**
* Cast a multidimensional array to a stdClass object.
*
* @param array $array
* The array to be converted
*
* @return object
* The multidimensional array converted to object
*/
@Cezarion
Cezarion / select_last_update.sql
Created November 19, 2013 14:00
Search last updated table / last changes on a database
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'
@Cezarion
Cezarion / wp_get_attachment_images.php
Created November 19, 2013 13:59
GET all attachemment images of a wp post
<?php
// GET all attachemment images :
//Show all images from array
function wp_get_attachment_images($attachements_id, $size = NULL)
{
if(count($attachements_id) >0 )
{
foreach ($attachements_id as $attachement_id => $id)
@Cezarion
Cezarion / wp_twitter_bootstrap_slideshow.php
Created November 19, 2013 13:58
Create twitter bootstrap slideshow in wordpress from attachement
<?php
/**
* Create caroussel with bootsrap twitter javascript components
*
* @param number $id
* @param string or number $size_of_image
* @param array $attr = array('id'=>'my_id', 'class' => 'class1 class2');
*
* @return html