Skip to content

Instantly share code, notes, and snippets.

View gravataLonga's full-sized avatar
🤓
Zig Nerding

Jonathan Fontes gravataLonga

🤓
Zig Nerding
View GitHub Profile
@gravataLonga
gravataLonga / sample.php
Last active December 18, 2015 13:09
site_url in php.
<?php
require 'site_url.php';
echo site_url(array('blog','como-criar-url'));
// output: http://www.jonathanfontes.pt/blog/como-criar-url
echo site_url('blog/como-criar-url');
// output: http://www.jonathanfontes.pt/blog/como-criar-url
@gravataLonga
gravataLonga / mit licence
Created September 8, 2012 20:37
MIT Licence
(c) Copyright 2012 Jonathan Fontes.
Licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@gravataLonga
gravataLonga / image_ratio_helper.php
Last active September 28, 2015 20:18
aspect ratio of an image
<?php
// Exists functions gmp_gcd ?
if(!function_exists('gmp_gcd')){
// No, so create
// find greatest common divisor
function gmp_gcd($a, $b) {
while ($b != 0)
$remainder = $a % $b;
$a = $b;
@gravataLonga
gravataLonga / view_helper.php
Created December 17, 2011 18:18
view system of MVC framework
<?php
// Function similar of MVC sistem
function view ( $file , $data = null){
// IF data different of null and diferrent than array
if($data!= NULL && !is_array($data)){
// Erro, expection.
throw new Exception('Data view isn\'t valid!');
return false;
}