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
@wilcorrea
wilcorrea / index.php
Last active October 5, 2016 22:04
receive use cors
<?php
header("Access-Control-Allow-Origin: *");
$output = [
'input' => null,
'post' => null,
'get' => null,
];
@wilcorrea
wilcorrea / Router.php
Last active October 22, 2016 19:33
Router.php
<?php
namespace Fagoc\Core;
class Router
{
private $method = 'GET';
private $uri = '';
/**
@wilcorrea
wilcorrea / construct.php
Last active January 16, 2017 16:56
Construct Converter
<?php
/**
* this file will run a function to read your php files, search for a constructor method and change:
* - public function NameOfClass
* to
* - public function __construct
*
* usage: php ./construct.php -d=/home/me/php/src -s=warning
*/
@wilcorrea
wilcorrea / $_GET.js
Last active November 4, 2016 19:16
<script>
function $_GET(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
const results = regex.exec(url);
if (!results) {
return null;
@wilcorrea
wilcorrea / nginx-gitweb.md
Created November 9, 2016 12:07 — forked from mcxiaoke/nginx-gitweb.md
Set up Gitweb + Nginx from scratch on Debian Wheezy

This guide offers the least time-consuming way of setting up Nginx for serving Git repositories over HTTP using Gitweb. The stuff here has been tested with Git 1.9.1 and Nginx 1.6.0 on Debian Wheezy. Probably also works for Ubuntu, etc.

Total time ~ 10 minutes.

Install

Enable wheezy-backports by adding this line to /etc/apt/sources.list:

deb http://http.debian.net/debian wheezy-backports main
@wilcorrea
wilcorrea / git-hosting-apache.conf
Created November 9, 2016 19:26 — forked from karmi/git-hosting-apache.conf
Configuration for hosting Git repositories with Apache 2.x
# ----------------------------------------------------------
# Configuration for hosting Git repositories with Apache 2.x
# ----------------------------------------------------------
#
# This setup provides "dual URLS", where URL like <http://git.example.com/my_repository.git>
# loads Gitweb in the browser and the same URL can be used in commands like `git clone` and `git remote add`.
# It was compiled from some sources on the internet and further customized/tuned.
#
# Please see documentation for:
#
@wilcorrea
wilcorrea / db.sql
Last active November 10, 2016 16:18
CREATE TABLE `clientes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
<?php
include 'conexao.php';
$noticias = $DB->query("SELECT * FROM noticias WHERE categoria = '{$_GET['categoria']}'");
while ($noticia = $DB->fetch($noticias)) {
?>
<div>
<?php
<?php
namespace HeroProject;
class Connection
{
// put the database stuffs here in that scope
}
{
"name": "company/project",
"description": "PHP Hero Project",
"minimum-stability": "dev",
"license": "proprietary",
"authors": [
{
"name": "Me",
"email": "myemal@mycompany.com"
}