Skip to content

Instantly share code, notes, and snippets.

View RinatValiullov's full-sized avatar
👷‍♂️
Looking for a job

Rinat Valiullov RinatValiullov

👷‍♂️
Looking for a job
View GitHub Profile
@RinatValiullov
RinatValiullov / Sololearn_challenge.md
Last active January 24, 2022 17:41
IIFE, scopes, explanation
What is the output of this code?
var a = 5; // (1)
!function(x) { // (2)
  a = x; // (3)
}(7); // (4)

console.log(a); // a = 7 (5)
@RinatValiullov
RinatValiullov / main.dart
Created December 17, 2021 20:11
Simple Flutter App(wip)
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@RinatValiullov
RinatValiullov / prim.py
Created October 26, 2020 11:24 — forked from siddMahen/prim.py
Prim's algorithm, in Python.
from sys import argv
import re
# open the file and get read to read data
file = open(argv[1], "r");
p = re.compile("\d+");
# initialize the graph
vertices, edges = map(int, p.findall(file.readline()))
graph = [[0]*vertices for _ in range(vertices)]
@RinatValiullov
RinatValiullov / distributeFiles.js
Created February 21, 2020 03:51
Move compiled(tsc) js files in parent directories next to `src` dirs. And delete `dist` folder created after compilation in the root directory
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
/*
const createDirectory = dirPath => {
const targetFolder = '/dist';
fs.mkdirSync(process.cwd() + (dirPath + targetFolder), { recursive: true }, (error) => {
if(error) {
console.error(error.message);
@RinatValiullov
RinatValiullov / upgrade_vim.sh
Created January 20, 2020 10:30 — forked from pythoninthegrass/upgrade_vim.sh
Update to Vim8 on Centos 7
# SOURCE: @zhouyanlt https://gist.github.com/yevrah/21cdccc1dc65efd2a4712781815159fb#gistcomment-2695800
sudo yum install -y gcc git ncurses-devel
git clone https://github.com/vim/vim.git ~/vim
cd ~/vim/src
make distclean # if you built Vim before
make -j8
sudo make install
cp -ru ~/vim/src/vim /usr/bin # overwrites /usr/bin/vim w/o confirmation

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@RinatValiullov
RinatValiullov / spell-output.js
Created November 29, 2019 20:52
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
[ 'something' ]
[ 'something', 'soothing' ]
@RinatValiullov
RinatValiullov / spell-index.js
Created November 29, 2019 20:52
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
// index.js
var natural = require('natural');
var corpus = ['something', 'soothing'];
var spellcheck = new natural.Spellcheck(corpus);
console.log(spellcheck.getCorrections('soemthing', 1));
console.log(spellcheck.getCorrections('soemthing', 2));
@RinatValiullov
RinatValiullov / phonetic-output.js
Created November 29, 2019 20:51
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
They sound alike!
FNTKS
@RinatValiullov
RinatValiullov / phonetic-index.js
Created November 29, 2019 20:51
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
// index.js
var natural = require('natural');
var metaphone = natural.Metaphone;
var soundEx = natural.SoundEx;
var wordA = 'phonetics';
var wordB = 'fonetix';
if (metaphone.compare(wordA, wordB))