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 / nativeJavaScript.js
Created October 25, 2018 15:39 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
@RinatValiullov
RinatValiullov / minification.md
Created April 24, 2019 06:55 — forked from gaearon/minification.md
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

@RinatValiullov
RinatValiullov / feature_detect_es_modules.js
Created June 14, 2019 04:38 — forked from ebidel/feature_detect_es_modules.js
Feature detect ES modules: both static import and dynamic import()
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->

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 / 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
@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)]