show dbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Useful links | |
Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise | |
*/ | |
/* | |
Custom Promise implementation | |
Promise is the object that stores state of async operation | |
It has public methods: | |
.then - consumer of the promise. Can have onResolve and onReject callback functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See list of docker virtual machines on the local box | |
$ docker-machine ls | |
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS | |
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1 | |
# Note the host URL 192.168.99.100 - it will be used later! | |
# Build an image from current folder under given image name | |
$ docker build -t gleb/demo-app . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Helpers = { | |
isMobile() { | |
let check = false; | |
(function (a) { | |
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|iko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cafa8f15d433cce619ded53146f6f17ee5f77293f3144932157fc075d6fd94cd1e194ad50fa38d6f74ac82365d89975ab89170fdec19f410b1de61cf121fcbd051123770856677126d766e875cc8b536906e52340e2ff8e32dc4190a1a1269b801817f699a4d9f6ccb1f2e71bfb9aff8dee5e296fa7557f95fb45436dd3f80678403e28b5d999bc057023fce7e9d7149eb66adcc61a71a7a58725b519a7a4abc0bafd7ff9bc8f41936aaa29218d0fca1efb028b6e90a00643c505111a321570f5fb4d58201b9d83af2fa790f998ef6514f9c8240d0d44d70d7ecd107e136837bdc3fd0f41458a93371ca31a153d7eb2bfc0776f975d49061d75cc1c90aa2a5fb7975555564595adc3916b71863d72de1b6ada8703bf0d4673863efaa5ede7c4b8c2fb4b275c501d72f9ee465b40234b8d79db061f148e0825b0e2552d850ff502dea9332fcc17a072f1572b78cddc1081abebccfcb4f9a0a4dbf0c8035594b9ede89e91c4b8443f852ceb61f8737f6127364c9d6900bdbd1a13b637d2bba9ec9bec513135f8bf8d77eb03da60f788ae9323e06f7758feaab0f1ea9abc57a7907bd2a52be24e094be4ae928468d219a7dca1ccc9b01990c5d2bb5ee031c0cc5fb1c0d21ab84c669fb9123faf0c0eb69a11e1cbe8bfa00289c188e8995be601af498b357fe7741efba6dbd18e4af1d6662647493a3a48e26cb2b133511d4b40301 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Check if element is unique in array | |
let testArr = [false, true, false, false, true, 10] | |
isUnique = function(arr, val) { | |
let auditor = [] | |
function isExist(index) { | |
return index === val | |
} | |
let filtered = arr.filter(isExist) | |
auditor = auditor.concat(filtered) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function User(f, l) { | |
this.f = f | |
this.l = l | |
this.print = function() { | |
console.log(this.f + ' ' + this.l) | |
} | |
} | |
let Vad = new User('Vadim', 'Kovalenko') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List() | |
var list = Immutable.List([1,2,3]) | |
// [1, 2, 3] | |
List.isList() | |
Immutable.List.isList(list) | |
// true | |
List.of() | |
var list = Immutable.List.of(1,2,3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
class DataService { | |
constructor(url) { | |
this.url = url; | |
} | |
async getUser(id) { | |
try { | |
let response = await fetch(`${this.url}/users/${id}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Subscribing to changes of redux store*/ | |
store.subscribe( | |
() => console.log(store.getState()) | |
); |
NewerOlder