Skip to content

Instantly share code, notes, and snippets.

View Krasnov8953's full-sized avatar

krasnov8953 Krasnov8953

View GitHub Profile
@Krasnov8953
Krasnov8953 / unpack.bash
Last active March 5, 2018 18:37
unpack tar.gz in terminal to opt folder
sudo tar xfz WebStorm-*.tar.gz -C /opt/
@Krasnov8953
Krasnov8953 / index.js
Created June 4, 2018 17:38
HMR React
if (module.hot && process.env.NODE_ENV !== 'production') {
console.log('HMR enabled')
module.hot.accept('./components/App', () => {
const NextApp = App.default
ReactDOM.render(
<NextApp />,
document.getElementById('root')
)
});
}
const debounce = (callback, delay) => {
let timerId;
return (...args) => {
timerId && clearTimeout(timerId);
timerId = setTimeout(
() => callback(...args),
delay
);
}
};
function memoize(func) {
const memo = {};
return function() {
const args = [...arguments];
if (args in memo) {
return memo[args];
}
else {
@Krasnov8953
Krasnov8953 / .hyper.js
Last active April 19, 2019 19:04
hyper.is sync
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
syncSettings: {
quiet: false,
accelerators: {
checkForUpdates: 'CmdOrCtrl+8'
@Krasnov8953
Krasnov8953 / index.js
Created September 12, 2019 09:34
regex for validating string containing only whitespaces
/^(?!\s).*$/
@Krasnov8953
Krasnov8953 / launch.json
Created January 29, 2020 17:14
vscode debug config
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Next: Chrome",