Skip to content

Instantly share code, notes, and snippets.

👷‍♂️
looking for a job

Rinat Valiullov RinatValiullov

👷‍♂️
looking for a job
View GitHub Profile
@RinatValiullov
RinatValiullov / distributeFiles.js
Created Feb 21, 2020
Move compiled(tsc) js files in parent directories next to `src` dirs. And delete `dist` folder created after compilation in the root directory
View distributeFiles.js
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 Jan 20, 2020 — forked from pythoninthegrass/upgrade_vim.sh
Update to Vim8 on Centos 7
View upgrade_vim.sh
# 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
View global-gitignore.md

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 / sentiment-index.js
Last active Dec 3, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View sentiment-index.js
// index.js
var natural = require('natural');
var Analyzer = natural.SentimentAnalyzer;
var stemmer = natural.PorterStemmer;
var analyzer = new Analyzer("English", stemmer, "afinn");
// getSentiment ожидает массив строк
console.log(analyzer.getSentiment(["I", "don't", "want", "to", "play", "with", "you"]));
@RinatValiullov
RinatValiullov / string_distance-index.js
Last active Dec 2, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View string_distance-index.js
// index.js
var natural = require('natural');
console.log(natural.HammingDistance("karolin", "kathrin", false));
console.log(natural.HammingDistance("karolin", "kerstin", false));
console.log(natural.HammingDistance("short string", "longer string", false));
@RinatValiullov
RinatValiullov / classification-index.js
Last active Dec 2, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View classification-index.js
// index.js
var natural = require('natural');
var classifier = new natural.BayesClassifier();
classifier.addDocument('i am long qqqq', 'buy');
classifier.addDocument('buy the q\'s', 'buy');
classifier.addDocument('short gold', 'sell');
classifier.addDocument('sell gold', 'sell');
classifier.train();
@RinatValiullov
RinatValiullov / spell-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View spell-output.js
[ 'something' ]
[ 'something', 'soothing' ]
@RinatValiullov
RinatValiullov / spell-index.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View spell-index.js
// 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 Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View phonetic-output.js
They sound alike!
FNTKS
@RinatValiullov
RinatValiullov / phonetic-index.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View phonetic-index.js
// 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))
You can’t perform that action at this time.