Skip to content

Instantly share code, notes, and snippets.

View wilcorrea's full-sized avatar
🚀
// TODO: be life good

William Correa wilcorrea

🚀
// TODO: be life good
View GitHub Profile
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
/** @noinspection PhpIncludeInspection */
$options = include dirname(__DIR__) . '/config/database.php';
$qb = new Hero\QueryBuilder($options);
#INSERT
$qb
@wilcorrea
wilcorrea / mg.svg
Created November 23, 2016 14:25 — forked from gabsprates/mg.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wilcorrea
wilcorrea / server-git.conf
Created December 1, 2016 12:55 — forked from massar/server-git.conf
Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# jeroen@massar.ch - http://jeroen.massar.ch
server {
listen 192.0.1.1:80;
listen [2001:db8::1]:80;
# Redirect all non-HTTPS traffic to the HTTPS variant
return 301 https://$host$request_uri;
}
<?php
namespace Hero;
class Router
{
private $routes = [];
public function on($method, $path, $callback) {
// make a hero return;
<?php
namespace Hero;
class Router
{
private $routes = [];
public function on($method, $path, $callback)
{
<?php
namespace Hero;
class Router
{
private $routes = [];
public function on($method, $path, $callback)
{
# sudo a2enmod modrewrite
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [NC,L]
<?php
namespace Hero;
class Router
{
private $routes = [];
# (...)
/**
<?php
define('__APP_ROOT__', dirname(__DIR__));
require __APP_ROOT__ . '/vendor/autoload.php';
use Hero\Router;
$router = new Router();
<?php
if (!function_exists('mysql_connect')) {
function mysql_connect((parameters)) {
return MySQL::connect((parameters)); // equivalente em mysqli
}
}
if (!function_exists('mysql_query')) {
function mysql_query($sql) {