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 / connect-remote-mongo-via-ssh-tunnel.md
Last active December 12, 2022 07:24
Create ssh tunnel and connect to the remote mongo database on command line

Create ssh tunnel and connect to the remote mongo database on command line

Assume followings:

/mykeys/.ssh/prodserver.pem - is a certificate file

umid - is a user name

111.111.111.111 - is a remote host, that mongodb runs

@umidjons
umidjons / decorator-babel-gulp-example.md
Last active January 3, 2019 13:14
Using decorators. Transpile with Babel. Configure Gulp task.

Using decorators. Transpile with Babel. Configure Gulp task.

Install necessary modules

npm i -D babel-cli babel-plugin-transform-decorators-legacy
npm i -D gulp gulp-sourcemaps gulp-babel

Configure npm run build and npm start commands. Also specify babel options, such as plugins.

@umidjons
umidjons / ssl-nginx.md
Last active November 6, 2017 20:44
Get Free SSL Certificate & Configure Nginx to use it

Get Free SSL Certificate & Configure Nginx to use it

  • Register on GoGetSSL.
  • Choose SSL Certificates -> Domain Validation SSL from top menu.
  • On products table click Details button on row Comodo - Free SSL.
  • On the opening page click Create New Order button.
  • In the Product Configuration section choose: Product Type = SSL Certificates and Select Item = Comodo Trial SSL, then click Complete Order button.
  • On the opening page click Incomplete Orders link.
  • In the List of all your SSL certificates table click Generate button.
  • With Online CSR Generator generate CSR.
@umidjons
umidjons / socket.io-client-events.md
Last active October 11, 2016 05:43
Socket.io Client events example

Socket.io Client (Manager) events example

npm i -S socket.io express jquery

File server.js:

var express = require('express');
var app = express();
@umidjons
umidjons / async-prog-overview.md
Created September 27, 2016 06:45
Asynchronous programming overview

Асинхронное программирование

  • операция, который результат доступен не сразу же, а через некоторое время
  • а также называют event driven programming

Примеры асинхронных операций:

  • обращение к диску за данными
  • сетевые обращение (БД, веб-сервер, кеш сервер)
@umidjons
umidjons / set-twig-variable-in-js-octobercms.md
Created September 23, 2016 08:00
Set JavaScript variable via Twig in OctoberCMS

Set JavaScript variable via Twig in OctoberCMS

record - is variable, that contains models (objects)

I passed JSON_PRETTY_PRINT, JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES constants into json_encode filter.

<script>
var infokioskList = JSON.parse("{{ records | json_encode(constant('JSON_PRETTY_PRINT') + constant('JSON_UNESCAPED_UNICODE') + constant('JSON_UNESCAPED_SLASHES')) | e('js') }}");
@umidjons
umidjons / angular-google-maps-example.md
Last active September 15, 2016 11:54
Angular Google Maps directive example

Angular Google Maps directive example

Prepare assets

bower init
bower i -S angular lodash angular-simple-logger angular-google-maps

File index.html:

@umidjons
umidjons / spawn-child-process.md
Created August 18, 2016 14:22
Spawn child process example

Spawn child process example

'use strict';

var spawn = require('child_process').spawn,
    pwd = spawn('cmd', ['/c', 'dir']);

pwd.stdout.on('data', (data) => {
 console.log('stdout:', data.toString());
@umidjons
umidjons / udp-client-server-nodejs.md
Created August 18, 2016 10:52
UDP Client/Server example

UDP Client/Server example

File server.js:

'use strict';

var dgram = require('dgram');
var server = dgram.createSocket('udp4');

const PORT = 3000;
@umidjons
umidjons / socket-client-server.md
Created August 18, 2016 08:29
Socket client/server example

Socket client/server example

File server.js:

'use strict';

var net = require('net');

const PORT = 3000;