Skip to content

Instantly share code, notes, and snippets.

View umidjons's full-sized avatar
🏠
Working from home

Umid umidjons

🏠
Working from home
View GitHub Profile
@umidjons
umidjons / jquery-paste-drop-events.md
Created August 22, 2014 04:03
Handle paste and drop events on jQuery

Handle paste and drop events on jQuery

Imagine we have .myinput input field, that we should process its value after text pasted into it. We can't access value in paste directly, so we should wait some time. For that purpose one can use setTimeout function. Here is example how to correctly handle paste event.

jQuery(document).ready(function($){
@umidjons
umidjons / telegram-bot-api-send-excel-file.md
Created July 13, 2018 06:46
Send an Excel file into Telegram group using node-telegram-bot-api

Send an Excel file into Telegram group using node-telegram-bot-api

import * as TelegramBot from 'node-telegram-bot-api';
import * as fs from 'fs';

const TOKEN = '<your_token_got_from_gotfather>';
const GROUP_ID = '<your_group_id>';
const FILE = './data.xlsx';
@umidjons
umidjons / compile-mql5.md
Created January 5, 2016 07:26
Compile MQL5 in console

Compile MQL5 from console

"c:\Program Files\MetaTrader 5\metaeditor64.exe" /portable /compile:candlestick_patterns.mq5 /inc:candlesticktype.mqh /log:mql.log
@umidjons
umidjons / web-service-soap-client-server-php.md
Last active May 28, 2023 21:34
Simple Web service - SOAP Server/Client in PHP

Simple Web service - SOAP Server/Client in PHP

Implementation of the SOAP server - server.php:

<?php
// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled","0");

// model, which uses in web service functions as parameter
@umidjons
umidjons / cursor-vs-toarray-mongoimport.md
Created January 22, 2016 18:10
Curvor vs toArray(). mongoimport example

Curvor vs toArray(). mongoimport example

Import data in JSON format into database

mongoimport -d mydb -c mycollection objects.json

Check imported data

@umidjons
umidjons / floating-label-placeholder-on-input-focus.md
Created October 21, 2016 11:03
Floating label (placeholder) on input focus

Floating label (placeholder) on input focus

Working fiddle

Sample code:

<style>
.wrapper { position: relative; }
@umidjons
umidjons / conv_5num_to_date.sql
Created July 5, 2013 11:08
Convert (Excel date) 5 digit numbers to date in mysql
SELECT
iar_d AS date_5_num, /* numbers like: 40479, 40298, 39038, 41075 */
DATE('1899-12-30') + INTERVAL iar_d DAY AS normal_date /* converted dates */
FROM registry_private_clinics
WHERE iar_d REGEXP '^[0-9]{5}$' /* only rows with NNNNN format, where N is [0-9] */
@umidjons
umidjons / formatters-parsers.md
Last active February 9, 2023 08:24
AngularJS `$formatters` and `$parsers` example

AngularJS $formatters and $parsers example

Understanding formatters and parsers:

  • Formatters change how model values will appear in the view.
  • Parsers change how view values will be saved in the model.
  // formats text going to user (from model to view)
  ngModel.$formatters.push(function(value) {
@umidjons
umidjons / files-array-normalize.md
Created March 31, 2014 14:35
Normalize $_FILES array when uploading multiple files (from php.net)

Normalize $_FILES array when uploading multiple files

When uploading multiple files, the $_FILES variable is created in the form:

Array
(
    [name] => Array
        (
            [0] => foo.txt
@umidjons
umidjons / yii2-app-root-path.md
Last active January 31, 2023 04:17
Set the application root path via .htaccess

Set the application root path via .htaccess

Create .htaccess file in the application root folder.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^web
RewriteRule ^(.*)$ web/$1 [L]