Skip to content

Instantly share code, notes, and snippets.

View brcontainer's full-sized avatar
👽
Try Inphinit PHP framework today!

Guilherme Nascimento brcontainer

👽
Try Inphinit PHP framework today!
View GitHub Profile
from flask import Flask
import urllib
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/youtubeproxy/<youtubeid>")
<?php
exec('reg export Hkey_local_Machine\Software\blabla C:\arquivo.reg');
$regfile = file_get_contents('C:/arquivo.reg');
$regfile = preg_replace('#(\r|\n)"|"(=)#', '$1$2', $regfile);
$parsed = parse_ini_string($regfile, false, INI_SCANNER_RAW);
@brcontainer
brcontainer / Evolution.any
Last active December 4, 2017 19:45
Linguagem imaginária (as extensões .any e .am são temporárias/imaginárias)
import Example # importa o Example.any
class Evolution extends Example:
public void __init__(): # Construtor
super(100, "teste", false) # Equivalente ao super do Java, ele "executa" o Example.__init__(args...) passando o argumentos
self.show() # Executa como o Example.show
public void __destroy__(): # É equivalente ao __destruct() do php ou Foo::~Foo() do C++
print("Bye :(")
@brcontainer
brcontainer / Evolution.any
Last active December 4, 2017 19:52
Linguagem imaginária mais semelhante ao "Python" (as extensões .any e .am são temporárias/imaginárias)
import Example # importa o Example.any
class Evolution extends Example:
public def __init__(): # Construtor
super("teste") # Equivalente ao super do Java, ele "executa" o Example.__init__(args...) passando o argumentos
self.show() # Executa como o Example.show
public def __destroy__(): # É equivalente ao __destruct() do php ou Foo::~Foo() do C++
print("Bye :(")
<?php
/*
* @param string $filename Path from windows executable
* @param string $encoding You need single-byte-character output, use ISO-8859-1
* @param int $limit increase limit if you tried read a big file and it returns NULL
* @return null|array
*/
function getFileVersionInfo($filename, $encoding = 'UTF-8', $limit = 15728640)
{
@brcontainer
brcontainer / ByteSize.php
Created March 13, 2018 15:29
Converte tamanho em Kb, Mb, Gb, Tb, etc
<?php
class ByteSize
{
const KB = 1;
const MB = 2;
const GB = 3;
const TB = 4;
const PB = 5;
const EB = 6;
const ZB = 7;
@brcontainer
brcontainer / Inphinit.md
Last active March 27, 2019 15:38
Install inphinit php framework without composer (using GIT)

Installing last release (or specific version)

git clone -b "0.2.0" https://github.com/inphinit/inphinit.git inphinit
git clone -b "0.2.0" https://github.com/inphinit/framework.git inphinit/system/vendor/inphinit/framework
cd inphinit

Installing dev-master

@brcontainer
brcontainer / getImageSizeInBytes.js
Last active March 27, 2019 17:43
Async get file size
function getImageSizeInBytes(imgURL, done, fail)
{
var request = new XMLHttpRequest;
request.open("HEAD", imgURL, true);
request.onreadystatechange = function () {
//Se ainda não for o 4 ignora com return
if (request.readyState != 4) return;

Getting start

Install Whoops (prefer version 2)

cd projectfolder
composer require filp/whoops

Or edite composer.json and set require values, like this:

<?php
...
$limite = AQUI VAI O VALOR DO BANCO;
$txt = preg_replace_callback('#(<br />)#', function ($i) use ($limite) {
static $conta1 = 0;
$retorno = $i[0];