Skip to content

Instantly share code, notes, and snippets.

View InFog's full-sized avatar
🤔
Thinking

Evaldo Bento InFog

🤔
Thinking
View GitHub Profile
@InFog
InFog / escopos.php
Created August 30, 2015 22:05
Escopos
<?php
$nome = 'InFog';
echo $nome; // InFog
function mostraNome()
{
$nome = 'Coragem';
echo $nome;
}
@InFog
InFog / inputs.php
Last active August 29, 2015 14:27
inputs.php
<?php
echo "\n*** Inputs ***";
echo "\n\nGET:"; print_r($_GET);
echo "\n\nPOST:"; print_r($_POST);
@InFog
InFog / sonicboom.php
Last active August 29, 2015 14:24
Sonic Boom
<?php
// Download medoo.php (http://medoo.in) and place it here:
require "/usr/local/lib/php/medoo.php";
function writeLog($message)
{
// If you don't want logs, use false
if (true) {
$message = date('Y-m-d H:i:s') . " " . $message . "\n";
@InFog
InFog / showjson.py
Last active August 29, 2015 14:23
Format JSON in your clipboarb
#!/usr/bin/env python3
from tkinter import Tk
from json import dumps, loads
def show_json_from_clipboard():
t = Tk()
t.withdraw()
@InFog
InFog / looptests.sh
Created February 16, 2015 08:46
PHPUnit inside a while loop
while true; do phpunit; sleep 2; done
@InFog
InFog / proceduralphp.md
Last active March 23, 2023 08:15
PHP Procedural Framework Manifesto

Procedural PHP Manifesto

We are web site developers (a.k.a. webmasters) and we just want to get stuff done. We don't need Object Orientation and we don't need Design Patters and other boring and not easy to learn and understand stuff to get in our way to get our sites up and running.

And that's why our values are:

  1. Procedural Code over Object Orientation
  • No one actually needs OO to develop web applications
  • Classes with only static functions are ok, since it's just a way to keep functions in one place. And is still procedural
  1. Explicitly load what you need over autoloaders
@InFog
InFog / Livros.md
Last active October 18, 2019 14:45
Livros para vender/doar

Programação / Dev

  • [Doado] jQuery A Biblioteca do Programador JavaScript | Maurício Samy Silva | Novatec
  • [Doado] CodeIgniter Framework PHP | Ademir Cristiano Gabardo | Novatec
  • [Doado] Python e Django Desenvolvimento Ágil de Aplicações Web | Osvaldo Santana e Thiago Galesi | Novatec
  • [Doado] Shell Script Profissional | Aurélio Marinho Jargas | Novatec
  • [Doado] O Melhor do JavaScript | Douglas Crockford | Alta Books
  • [Doado] Padrões JavaScript | Stoyan Stefanov | Novatec
  • [Doado] O Melhor do PHP | Peter B. MacIntyre | Alta Books
  • [Doado] Autenticação Centralizada com OpenLDAP | Marcos Sungaila | Novatec
@InFog
InFog / example.conf
Created October 1, 2014 22:37
Nginx basic example with rewrite and PHP-FPM
server {
server_name example;
root /var/www/example;
index index.php index.html index.htm;
# error_log /var/log/nginx/example.error_log debug;
rewrite_log on;
location ~* ^/(assets|css|fonts|img|js|upload) { }
@InFog
InFog / supers_init.py
Created August 21, 2014 11:18
Example of Python's parent __init__ with super (Python 2)
class Person(object):
def __init__(self, name):
self.name = name
class Customer(Person):
def __init__(self, name, credit):
super(Customer, self).__init__(name)
self.credit = credit
@InFog
InFog / redirects.py
Created May 15, 2014 01:34
HTTP codes for redirects in Flask
from flask import Flask, redirect, url_for
app = Flask(__name__)
@app.route("/page_to_redirect")
def page_to_redirect():
"""Using a 307 (TEMPORARY REDIRECT)"""
return redirect(url_for("destination")), 307