Skip to content

Instantly share code, notes, and snippets.

View afranioce's full-sized avatar
🏠
Working from home

Afranio Martins afranioce

🏠
Working from home
View GitHub Profile
<?php
interface ModelInterface
{
public function fields(): array;
}
class Item implements ModelInterface
{
private $value;
@afranioce
afranioce / crypto.ts
Created June 5, 2019 20:30
A simple crypto to typescript
class Crypto {
constructor(private salt: string) { }
public encrypt(text: string) {
return this.textToChars(text)
.map(code => this.applySaltToChar(code))
.map(char => this.byteHex(char))
.join('');
}
@afranioce
afranioce / form-data-builder.ts
Created June 5, 2019 17:44
Format deep object to formData
class FormDataBuilder {
static BuildObject2FormData<T>(obj: T): FormData {
const formData: FormData = new FormData();
if (obj == null) {
return formData;
}
this.PopulateFormData(formData, '', obj);
return formData;
Prioridade
"Prioridade: Crítica"
Deve ser tratado o mais rápido possível.
"Prioridade: Alta"
Depois que os problemas críticos são corrigidos, deve ser resolvido quanto antes.
"Prioridade: Média"
Esse problema pode ser útil e precisa de alguma atenção.
@afranioce
afranioce / tsuru.yml
Created August 3, 2017 11:58
Usando composer customizado no tsuru
php:
version: 5.6
composer: false
frontend:
name: apache
options:
modules:
- rewrite
interpretor:
name: fpm55
@afranioce
afranioce / QueryBuild.js
Last active November 21, 2016 13:54
Query Build
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@afranioce
afranioce / index.js
Created March 2, 2015 01:22
Appcelerator swipe card like tinder
var win = Titanium.UI.createWindow({
backgroundColor: "#ffffff",
title: "win"
});
// animations
var animateLeft = Ti.UI.createAnimation({
left: -520,
transform: Ti.UI.create2DMatrix({rotate: 60}),
opacity: 0,
@afranioce
afranioce / CpfCnpj.php
Last active August 14, 2020 11:17
Validador de cpf e cnpj para symfony2
<?php
namespace AppBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
language: php
php:
- 5.3
mysql:
database: drupal
username: root
encoding: utf8