Skip to content

Instantly share code, notes, and snippets.

@ianitsky
ianitsky / nextString.js
Created January 10, 2023 12:39
ChatGPT: Create a javascript function that receive a string and return the next string using only the following chars "346789ABCDEFGHJKLMNPQRTUVWXYZ". Example: for string "3" the next is "4". For string "34" the next is "36". For string "AAAA" the next is "AAAB". For string "AAAZ" the next is "AAB3".
function nextString(str) {
let chars = "346789ABCDEFGHJKLMNPQRTUVWXYZ";
let result = "";
let carry = true;
for (let i = str.length - 1; i >= 0; i--) {
let index = chars.indexOf(str[i]);
@ianitsky
ianitsky / javascript.md
Last active December 3, 2018 14:34
Javascript

Default float money to real money

value.toLocaleString('pt-br', {minimumFractionDigits: 2})

Mask

Postcode

import MaskedInput from 'react-text-mask';
@ianitsky
ianitsky / README.md
Last active November 28, 2018 11:13
Transform json to magento2 search criteria

HOW TO USE

const searchCriteria = {
  sortOrders: [
    {
      field: "status",
      direction: "ASC"
 },
@ianitsky
ianitsky / Data.php
Created August 9, 2018 19:06
Magento - Add textarea to admin system config tables
<?php
/**
* Use
*/
class Module_Adminhtml_Block_Config_Data extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{
protected $_textareaRenderer;
public function __construct()
{
@ianitsky
ianitsky / custom.js
Created December 17, 2013 19:17 — forked from drewjoh/custom.js
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {