Skip to content

Instantly share code, notes, and snippets.

View CesarBalzer's full-sized avatar

Cesar E. Balzer CesarBalzer

  • Freelancer
  • Ponta Grossa, PR - Brasil
View GitHub Profile
@CesarBalzer
CesarBalzer / generateCpfCnpjFunction
Last active February 7, 2024 19:28
POSTMAN - Generate CPF/CNPJ valids, optional format
pm.globals.set("generateCpfCnpjFunction", `
function generateCpfCnpj(isCpf, format) {
//--CPF
function calculateVerificationDigit(part1, part2, part3, firstVerificationDigit) {
const numbers = \`\${part1}\${part2}\${part3}\`.split("");
if (firstVerificationDigit !== undefined) {
numbers[9] = firstVerificationDigit;
}
@CesarBalzer
CesarBalzer / js
Created October 27, 2022 01:50
Gregorian Characters
const gregorian_chars = [
{ id: 1, text: 'Alpha', color: 'violet', symbol:'α', letter:'A' },
{ id: 2, text: 'Beta', color: 'dodgerblue', symbol:'β', letter:'B' },
{ id: 3, text: 'Gama', color: 'green', symbol:'γ', letter:'Γ' },
{ id: 4, text: 'Delta', color: 'orange', symbol:'δ', letter:'Δ' },
{ id: 5, text: 'Épsilon', color: 'brown', symbol:'ε', letter:'E' },
{ id: 6, text: 'Zeta', color: 'red', symbol:'ζ', letter:'Z' },
{ id: 7, text: 'Etá', color: 'blue', symbol:'η', letter:'H' },
{ id: 8, text: 'Teta', color: 'gray', symbol:'θ', letter:'Θ' },
{ id: 9, text: 'Iota', color: 'yellow', symbol:'ι', letter:'I' },
@CesarBalzer
CesarBalzer / example_dt_f7.txt
Last active March 16, 2020 12:12
Example my structure with Datatables.net/Framework7
VERSION FRAMEWORK7 v4
//Structure INDEX.HTML
-----------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
@CesarBalzer
CesarBalzer / gist:3242ccfbdfa822acf25beb43fcb209ee
Last active March 16, 2020 11:42
Example create custom post type
public function new_cpt_service() {
$labels = array(
'name' => _x( 'Servicos', 'api' ),
'singular_name' => _x( 'Serviço', 'api' ),
'add_new' => _x( 'Adicionar novo', 'api' ),
'add_new_item' => __( 'Novo serviço', 'api' ),
'edit_item' => __( 'Editar serviço', 'api' ),
'new_item' => __( 'Novo serviço', 'api' ),
'all_items' => __( 'Todos os serviços', 'api' ),
'view_item' => __( 'Visualizar serviço', 'api' ),
// EDIT ORDER
[28-Jan-2020 01:44:47 UTC] Automattic\WooCommerce\Admin\Overrides\Order Object
(
[refunded_line_items:protected] =>
[status_transition:protected] =>
[data:protected] => Array
(
[parent_id] => 0
[status] => completed
[currency] => BRL
@CesarBalzer
CesarBalzer / GoogleDrive.js
Created October 20, 2019 17:21
Google Drive Upload Image and Make Public and Get Link with NodeJS
/*
// credentials.json
{
"installed": {
"client_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com",
"project_id": "XXXXXXXXXXXXXXXXXXXXXXXX",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
@CesarBalzer
CesarBalzer / soap-curl-shell
Created September 27, 2019 00:45 — forked from gustavohenrique/soap-curl-shell
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>
@CesarBalzer
CesarBalzer / json_to_csv.js
Created September 3, 2019 12:18 — forked from dannypule/json_to_csv.js
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];
@CesarBalzer
CesarBalzer / API.md
Created August 2, 2019 00:45 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

const Model = require( './model' )
const createController = '../../helpers/createController'
module.exports = require( createController )( Model )( __dirname )