Skip to content

Instantly share code, notes, and snippets.

View roggeo's full-sized avatar
🎯
Focusing

Geovani roggeo

🎯
Focusing
View GitHub Profile
@vitorfreitas
vitorfreitas / format.js
Created December 10, 2018 22:57
Formatar strings que representam dinheiro em React Native
export const formatNumber = (amount, decimalCount = 2, decimal = ",", thousands = ".") => {
try {
decimalCount = Math.abs(decimalCount);
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
const negativeSign = amount < 0 ? "-" : "";
let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
let j = (i.length > 3) ? i.length % 3 : 0;
@roggeo
roggeo / Cli_Config_Doctrine_ORM_for_Zend_Framework_3.txt
Last active November 29, 2018 21:32
Cli Config Doctrine ORM for Zend Framework 3
<?php
//Insert in config folder as file name cli-config.php
require_once "vendor/autoload.php";
// bootstrap.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
@nikic
nikic / portAlternativeTags.php
Created September 12, 2014 17:41
Tool for porting alternative PHP tags to <?php, <?= and ?>
<?php
/*
* Note: This script will directly modify the .php files in the given directory.
* It is assumed that the code is under version control, so you can easily review
* the changes using `git diff` or similar.
*/
function usageError() {
die("Usage: php -d asp_tags=1 portAlternativeTags.php dir/\n");