Skip to content

Instantly share code, notes, and snippets.

View dagolinuxoid's full-sized avatar
💭
u did it!!

Artur Haurylkevich dagolinuxoid

💭
u did it!!
View GitHub Profile
@dagolinuxoid
dagolinuxoid / init.vim
Created October 19, 2017 17:36
neo | config
" ~/.config/nvim/init.vim
3
2 " ~/.local/share/nvim/site/pack/git-plugins/start
1
5 " Colorscheme ^^
1 colorscheme dago
2
3 " self-explanatory
4 syntax on
5 set number
@dagolinuxoid
dagolinuxoid / keybindings.json
Created September 19, 2017 05:55
vs code | keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+h", "command": "cursorLeft",
"when": "editorTextFocus" },
{ "key": "ctrl+j", "command": "cursorRight",
"when": "editorTextFocus" },
{ "key": "ctrl+u", "command": "cursorUp",
"when": "editorTextFocus" },
{ "key": "ctrl+l", "command": "cursorDown",
"when": "editorTextFocus" },
@dagolinuxoid
dagolinuxoid / settings.json
Created September 19, 2017 05:53
vs code | my user settings file | visual studio code
// Place your settings in this file to overwrite the default settings
{
"workbench.activityBar.visible": true,
"workbench.statusBar.visible": true,
"window.zoomLevel": 0,
"editor.fontFamily": "Liberation Mono",
"editor.fontSize": 14,
"editor.minimap.enabled": false,
"files.associations": {
"*.html": "html"
@dagolinuxoid
dagolinuxoid / pointers.c
Created April 21, 2017 18:38
pointers are easy but syntax is sucks.
#include <stdio.h>
int main (void) {
int k = 42;
int *pointerToKadress;
pointerToKadress = &k; // an address | without asterisk
*pointerToKadress = 29; // a value placed at this address | go to this location and do something
printf("%s updated\n", *pointerToKadress == k ? "true" : "false"); // true
printf("%s updated|address %i\n", pointerToKadress == k ? "true" : "false", pointerToKadress); // false
}
@dagolinuxoid
dagolinuxoid / sortAlgorithm.js
Last active April 16, 2017 10:32
JS | selectionSort && bubbleSort && insertionSort | it is my poor implementation ... I guess || maybe it's not that bad
//selection sort
function selectionSort(arr) {
let indexOfSmallestItem = 0;
// really? LOL
let j = 0;
let i = 0;
let placeholder;
while (j < arr.length) {
for ( ; i < arr.length; i++) {
// find smallest item in the array
@dagolinuxoid
dagolinuxoid / functionsVeryBasics.js
Last active March 24, 2017 11:43
#function #parameter #argument
//just my own thoughts about it. Actually I've had similar issues before.
function confusion() {
var x = 5; // hard-coded assignment
console.log(x);
}
confusion(); // call a function with hard-coded 5 value
function dontBeConfused(x // hey I'm a parameter, that is a placeholder for a future value/argument ) {
// putting x parameter this way is pretty mutch the same as creating a variable inside the function
@dagolinuxoid
dagolinuxoid / learnWebCode.js
Created February 14, 2017 12:53
#json #ajax
var pageCounter = 1;
var animalContainer = document.getElementById('animal-info');
var btn = document.getElementById('btn');
btn.addEventListener('click',function() {
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET','https://learnwebcode.github.io/json-example/animals-' + pageCounter + '.json');
ourRequest.onload = function() {
var ourData = JSON.parse(ourRequest.responseText);
renderHTML(ourData);
};
@dagolinuxoid
dagolinuxoid / thisCallBIndApply.js
Last active January 27, 2017 07:06
#this #call #bind #apply
var obj = { name: 'smith' };
function outer() {
(function inner() {
console.log(this.name);
}).call(this);
}
function outer() { // same result as above
(function inner() {
@dagolinuxoid
dagolinuxoid / JSONexplained.js
Last active January 26, 2017 09:14
#JSON #KANTOR #answer
// Автор всё верно написал, но у Вас возникла объяснимая двусмысленность, сейчас поясню:
// Реализация слов автора
var str = '{"title":"Конференция","date":"2014-11-30T12:00:00.000Z"}';
var event = JSON.parse(str, function(key, value) {
if (key == 'date') return undefined; // Относится к этому месту кода; соответствующая пара key/value будет пропущена/удалена
return value;
});
// Ваша ошибочная интерпретация
@dagolinuxoid
dagolinuxoid / calcTask.js
Last active January 22, 2017 11:34
https://learn.javascript.ru/constructor-new >> Задачи >> Создайте калькулятор | fun
---
version 1
---
//Oops... well, there probably was so much 'shame' that I decided to delete it :)
---
version 2
---