Skip to content

Instantly share code, notes, and snippets.

View gabrieljmj's full-sized avatar
💻
Working from home

Gabriel Jacinto gabrieljmj

💻
Working from home
  • Zig
  • Itajobi, SP, Brazil
View GitHub Profile
<?php
return [
// http://www.cidades.ibge.gov.br/download/mapa_e_municipios.php?uf=ac (Thu May 14 16:30:15 BRT 2015)
'AC' => [
1200013 => 'Acrelândia',
1200054 => 'Assis Brasil',
1200104 => 'Brasiléia',
1200138 => 'Bujari',
1200179 => 'Capixaba',
@gabrieljmj
gabrieljmj / README.md
Last active August 29, 2015 14:19
Solving math problems

@gabrieljmj
gabrieljmj / eg.js
Last active July 20, 2023 08:21
Psr4 implementation NodeJS
psr4.add('Gabrieljmj\\Blog\\', 'modules/gabrieljmj/blog/');
psr4.add('Gabrieljmj\\Blog\\Controller\\', 'modules/gabrieljmj/blog/constrollers/');
var postsController = psr4.use('Gabrieljmj\\Blog\\Posts'); //require('modules/gabrieljmj/blog/Posts')
var postsController = psr4.use('Gabrieljmj\\Blog\\Controller\\Posts'); //require('modules/gabrieljmj/blog/controllers/posts')
@gabrieljmj
gabrieljmj / Environment.php
Created February 17, 2015 23:20
Simple Should port for PHP - complete framework https://github.com/GabrielJMJ/ShouldPHP
<?php
class Environment
{
private $shouldState;
private $verbs = array('be', 'have');
private $toTest;
public function __construct($toTest, $shouldState = false, $verb = null)
{
$this->toTest = $toTest;
@gabrieljmj
gabrieljmj / HideStaticMethods.php
Last active August 29, 2015 14:15
Hidding static methods
<?php
namespace Gabrieljmj;
trait HideStaticMethods
{
public function __call($method, $args)
{
return foward_static_call_array(array(self, $method), $args);
}
}
@gabrieljmj
gabrieljmj / README.md
Last active August 29, 2015 14:14
Why numbering should start at one - representation class PHP
$images = array(
1 => 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSwN2pF0jnnNlxtNRythauTtBgtNFTSx0ucRHeKfahoo33XEtFjUEYVfnE',
2 => 'http://i7.photobucket.com/albums/y266/Linkforce712/SEA01.png'
);
$arr = array(1, 1, 1, 1, 1, 1);
$arr2 = array(1, 2, 2, 2, 2, 1);
$arr3 = array(1, 1, 1, 1, 1);
function transform($images)
@gabrieljmj
gabrieljmj / example.php
Last active August 29, 2015 14:08
Solving Quadratic Formula with Bhaskara
<?php
print_r(quadEq(1, 2, 1));// a=1 b=2 c=3 (x² + 2x + 3 = 0)
//Result: array(-1)
@gabrieljmj
gabrieljmj / extern-request.php
Created October 15, 2013 18:41
Verify if exists an extern request
<?php
if( isset( $_SERVER['HTTP_REFERER'] ) and !stristr( $_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'] ) ){
//...
}
@gabrieljmj
gabrieljmj / Converter.class.php
Last active November 22, 2017 12:07
Currency converter using Google API You must have the curl extension in PHP active.
<?php
/**
* @author @GabrielJMJ /twitter
* @description Abstract class to define a interface of a converter
* @link https://gist.github.com/GabrielJMJ/6977968 Gist on GitHub
**/
abstract class Converter{
protected $valueWithCurrency;
protected $toCurrency;