Skip to content

Instantly share code, notes, and snippets.

View nikonov91-dev's full-sized avatar

Alex Nikonov nikonov91-dev

View GitHub Profile
semantic versioning
https://semver.org/lang/ru/
@nikonov91-dev
nikonov91-dev / pattern.js
Last active January 23, 2019 08:20
replace jquery component with react component in vanilla js
//the source https://medium.com/@andreasmcd/how-my-team-converted-our-website-from-jquery-to-react-in-small-steps-cd4390f0a146
//before :
// The controller manages all events and will update the page as necessary.
// In this example there is not much happening.
// But in our real application, these controllers could be very large and own a lot of logic.
class Controller {
constructor() {
this.$openModalBtn = $('#openModal');
this.$mediaModal = $('#mediaModal');
https://www.codewars.com/kata/chess-fun-number-12-possible-rook-moves/train/javascript
function possibleRookMoves(b, square, flag) {
const letter = square[0].toLowerCase(),
letterNum = letter.charCodeAt(0) - 97,
num = b.length - square[1],
arrayNum = num + 1,
enemy = flag === 1 ? -1 : 1,
ally = flag === 1 ? 1 : -1;
const row = definePosition(b[num],'hor', letterNum)
@nikonov91-dev
nikonov91-dev / *.ththeme
Last active July 15, 2018 06:09
Change class color in VisualStudio Code, setup custom color for VSCode, VSCode settings
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "entity.name.class, entity.name.type",
"settings": {
"foreground": "#A6E22E"
}
}]
}
@nikonov91-dev
nikonov91-dev / gist:839e1686ff5c66b36d89097e78d59c80
Created March 22, 2018 21:04
vertical text equivalent to text-orientation
width:1em;
word-break:break-word;
float:left;
letter-spacing:1em;
white-space:pre-wrap
@nikonov91-dev
nikonov91-dev / cocktail_sort.js
Created November 24, 2017 16:32
practice in creating cocktail sorting
<script>
var num = [10, 100, 2, 0, 10, 50];
var text = "<ul>" + num;
var startAgain = false;
var temp;
for ( i = 0, i < num.lenght, i++ ){
for ( j = 0, j < num.lenght-1-i, j++){
do
if ( num[j] > num[j+1]){
startAgain = true;