Skip to content

Instantly share code, notes, and snippets.

View BekNaji's full-sized avatar

Bekzod BekNaji

  • Multibank
  • Tashkent, Uzbekistan
View GitHub Profile
@BekNaji
BekNaji / add_icon_by_card_number.dart
Created September 9, 2024 11:34
Add icon by card number
Builder(builder: (context) {
RegExp visaRegExp = RegExp(r'^4[0-9]{3}');
RegExp mastercardRegExp =
RegExp(r'^5[1-5][0-9]{2}|^2[2-7][0-9]{2}');
RegExp humoRegExp = RegExp(r'^9[0-9]{3}');
RegExp uzcardRegExp = RegExp(r'^8[0-9]{3}');
if (visaRegExp.hasMatch(params.number!)) {
return Image.asset(Assets.visaPng, height: SIZE_16);
} else if (mastercardRegExp
.hasMatch(params.number!)) {
let widget = ExternalWidgetBuilder()
.buildDefaultWidget(
accountName: account,
location: location,
visitorFields: visitorFields
)
@BekNaji
BekNaji / ExternalWidgetBuilder.swift
Created April 24, 2024 12:51
Webim Widget builder
//
// ExternalWidgetBuilder.swift
// WebimWidget_Example
//
// Created by Аслан Кутумбаев on 14.03.2023.
// Copyright © 2023 Webim. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
</Relationships>
function exportHTML(){
var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' "+
"xmlns:w='urn:schemas-microsoft-com:office:word' "+
"xmlns='http://www.w3.org/TR/REC-html40'>"+
"<head><meta charset='utf-8'><title>Export HTML to Word Document with JavaScript</title></head><body>";
var footer = "</body></html>";
var sourceHTML = header+document.getElementsByClassName("fr-view")[0].innerHTML+footer;
var source = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(sourceHTML);
var fileDownload = document.createElement("a");
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:WX="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:w10="urn:schemas-microsoft-com:office:word"
@BekNaji
BekNaji / pretty_bank_code.dart
Created March 1, 2023 11:30
pretty bank code in flutter | dart
void main() {
var item = "12345678911234567891";
print(prettyBankCode(item)); // 1234 5678 9112 3456 7891
}
prettyBankCode(item){
if(item != null && item.length == 20){
var code = item.substring(0,4);
code = code + ' ' + item.substring(4,8);
code = code + ' ' + item.substring(8,12);
@BekNaji
BekNaji / text.dart
Created February 2, 2023 11:23
Capitalize text in dart
// SOFTWARE developer ----> Software Developer
String capitalizeAllWord(String val) {
var value = val.toLowerCase();
var result = value[0].toUpperCase();
for (int i = 1; i < value.length; i++) {
if (value[i - 1] == " ") {
result = result + value[i].toUpperCase();
} else {
result = result + value[i];
}
@BekNaji
BekNaji / crm_deal_function.php
Last active August 31, 2022 10:33
This function is changing response of live search contacts inside deal form (Bitrix24 CRM)
<?php
// Developer: Bekzod
$crm_api_entity_search = isset($_REQUEST['action']) && $_REQUEST['action'] == 'crm.api.entity.search' ? true : false;
if($crm_api_entity_search)
{
$request = $_REQUEST;
if(isset($request['options']['types'][0]) && $request['options']['types'][0] == 'CONTACT')
{
@BekNaji
BekNaji / bitrix-permissions
Created August 30, 2022 11:16
bitrix permissions of folders and files.txt
cd ~/www
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;
find . -type d -exec chown bitrix:bitrix {} \;
find . -type f -exec chown bitrix:bitrix {} \;