Skip to content

Instantly share code, notes, and snippets.

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