Skip to content

Instantly share code, notes, and snippets.

@KonstKh
KonstKh / index.html
Created June 15, 2020 16:35
JS Bin [create list of Month's automatically] // source https://jsbin.com/wedubal
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[create list of Month's automatically]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
create list of Month's automatically
@KonstKh
KonstKh / async-component.jsx
Created June 5, 2019 12:30
React async setState, because await.
import React, { Component } from 'react';
export default class AsyncComponent extends Component {
setState(state, cb) {
return new Promise((resolve) => {
super.setState(state, async () => {
if (cb) {
await cb();
}
@KonstKh
KonstKh / README.md
Created July 10, 2018 14:17 — forked from hofmannsven/README.md
My simply Raspberry Pi Cheatsheet
@KonstKh
KonstKh / .eslintrc.js
Created April 7, 2018 22:37 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@KonstKh
KonstKh / _readme.md
Created March 25, 2018 14:20 — forked from shime/_readme.md
github oauth in node using express

What?

Most basic example of authenticating with Github in node.

How?

Clone this gist, change keys inside config.js and then hit npm install && node app.js.

Done?

@KonstKh
KonstKh / IsElementInViewPort
Created January 9, 2018 09:09
Check if DOM element is in view port
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
@KonstKh
KonstKh / README.md
Created December 19, 2017 18:14 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@KonstKh
KonstKh / HashTable.js
Created December 16, 2017 16:18 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@KonstKh
KonstKh / index.html
Created December 12, 2017 10:31
JS Bin [throttle scroll event] // source http://jsbin.com/mayanujeyo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[throttle scroll event]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.big{
color: red;
@KonstKh
KonstKh / mongolog.txt
Last active December 7, 2017 13:41
Mongo replica creation log
docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
manager1 - virtualbox Running tcp://192.168.99.106:2376 v17.11.0-ce
worker1 - virtualbox Running tcp://192.168.99.107:2376 v17.11.0-ce
worker2 - virtualbox Running tcp://192.168.99.108:2376 v17.11.0-ce
$ bash < create-replica-set.sh
···························
·· swtiching >>>> manager1 server ··
···························