Skip to content

Instantly share code, notes, and snippets.

View bahkostya's full-sized avatar
👽

Kostiantyn Bahinskyi bahkostya

👽
  • The Hague, The Netherlands
View GitHub Profile
import { nodeResolve } from 'Y:/dev/deps/node_modules/@rollup/plugin-node-resolve';
import commonjs from 'Y:/dev/deps/node_modules/@rollup/plugin-commonjs';
import clear from 'Y:/dev/deps/node_modules/rollup-plugin-clear';
import esbuild from 'Y:/dev/deps/node_modules/rollup-plugin-esbuild';
import alias from 'Y:/dev/appdev/client/node_modules/@rollup/plugin-alias';
export default {
input: 'index.js',
output: {
dir: 'dist',
@bahkostya
bahkostya / reset-websql-database.js
Created March 11, 2021 14:15 — forked from partageit/reset-websql-database.js
Reset WebSQL database dropping every tables
var db = openDatabase('myDatabase', '', 'My database description', 5 * 1024 * 1024);
if (reinitDb) {
db.changeVersion(db.version, '', function(t) {
t.executeSql("SELECT name FROM sqlite_master WHERE type='table' and name not like '__Webkit%'", [], function(sqlTransaction, sqlResultSet) {
var table, tablesNumber = sqlResultSet.rows.length;
console.log('DATABASE RESET MODE ENABLED');
for (var i = 0; i < tablesNumber; i++) {
table = sqlResultSet.rows.item(i);
console.log('Removing table: ' + table.name);
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
{
"extends": ["tslint-react", "tslint-config-airbnb", "tslint-config-prettier"],
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"ban": false,
@bahkostya
bahkostya / LICENSE.txt
Created October 18, 2018 21:11 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bahkostya
bahkostya / updating-subscriptions-when-props-change-example.js
Created April 23, 2018 08:52 — forked from bvaughn/updating-subscriptions-when-props-change-example.js
Advanced example for manually updating subscriptions in response to props changes in an async-safe way
// This is an advanced example! It is not typically required for application code.
// If you are using a library like Redux or MobX, use the container component provided by that library.
// If you are authoring such a library, use the technique shown below.
// This example shows how to safely update subscriptions in response to props changes.
// In this case, it is important to wait until `componentDidUpdate` before removing a subscription.
// In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely.
// We also need to be careful about how we handle events that are dispatched in between
// `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`.
@bahkostya
bahkostya / eager-prefetching-async-data-example.js
Created April 23, 2018 08:52 — forked from bvaughn/eager-prefetching-async-data-example.js
Advanced example for eagerly prefetching async data in a React component.
// This is an advanced example! It is not intended for use in application code.
// Libraries like Relay may make use of this technique to save some time on low-end mobile devices.
// Most components should just initiate async requests in componentDidMount.
class ExampleComponent extends React.Component {
_hasUnmounted = false;
state = {
externalData: null,
};
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export default createStore(
rootReducer,
@bahkostya
bahkostya / .eslintrc
Last active December 25, 2016 11:43
eslint config
{
"env": {
"browser": true,
},
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],