Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
Working on Code

Lucas lucasprogamer

🕶️
Working on Code
View GitHub Profile
View valid-cpf.js
cfpValido () {
const regexCPF = /^\d{3}\.\d{3}\.\d{3}-\d{2}$/
let i = 0
let soma = 0
let resto = 0
if (regexCPF.test(this.cpf)) {
for (i = 1; i <= 9; i++) {
soma = soma + parseInt(this.cpf.substring(i - 1, i)) * (11 - i)
}
resto = soma % 11
View .editorconfig
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 4
# We recommend you to keep these unchanged
@lucasprogamer
lucasprogamer / money.js
Created Apr 8, 2020
Prototype para money
View money.js
Number.prototype.formatMoney = function (places, symbol, thousand, decimal) {
places = !isNaN(places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "$";
thousand = thousand || ",";
decimal = decimal || ".";
var number = this,
negative = number < 0 ? "-" : "",
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : "");
@lucasprogamer
lucasprogamer / style.scss
Created Mar 27, 2019
Bulma SCSS columns
View style.scss
.column {
display: block;
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
padding: 0.75rem;
}
.columns {
&.is-mobile > .column {
View BulmaWalker.php
<?php
namespace App\Lib;
use Utils;
class BulmaWalker extends \Walker_Nav_Menu
{
private $cpt; // CPT, is current post a custom post type
private $archive; // Stores the archive page for current URL
public function __construct()
@lucasprogamer
lucasprogamer / functions.php
Created Jun 29, 2018
Add collumn to metabox of invoices woocomerce
View functions.php
add_action( 'woocommerce_admin_order_item_headers', 'collumn_invoice_header' );
function collumn_invoice_header($order){
?>
<th class="line_produtor_title sortable" data-sort="your-sort-option">
name collumn
</th>
<?php
}
@lucasprogamer
lucasprogamer / php.mdown
Created Jun 25, 2018
malformed header from script. Bad header=&lt;br /&gt;: index.php
View php.mdown

this error happens because exists tags from olds version of PHP

check if exists in php.ini and remove or comment allow_call_time_pass_reference

check if exist any tag unable in php 7.1 like

;asp_tags = Off ;register_globals = Off

View set-robot-git-ftp.md

.git-ftp-ignore | Conteúdo abaixo

bower_components/* node_modules/*

.git-ftp-include | Conteúdo abaixo

vendor/:composer.lock

Dentro da pasta .git, checar arquivo config

View docker-composer.yml
version: '2'
# Named volumes
volumes:
# MySQL Data
wordpress-mysql-data:
driver: local
# Redis Data
You can’t perform that action at this time.