Skip to content

Instantly share code, notes, and snippets.

@PetrSnobelt
PetrSnobelt / getLogger.js
Created May 16, 2019 20:32
JS Proxy logger
var getLogger = (prefix = "") => ({
get: function(zdroj, vlastnost){
console.log(prefix, "try access", vlastnost);
if(vlastnost in zdroj){
return zdroj[vlastnost];
} else {
return 37;
}
},
defineProperty: function (oTarget, sKey, oDesc) {
@PetrSnobelt
PetrSnobelt / GOLv3.js
Created June 27, 2018 14:30
Game Of life in ES6 v3
// Using ES6
const nearZero = [[-1,-1], [0,-1], [1,-1],
[-1, 0], [1, 0],
[-1, 1], [0, 1], [1, 1]]
const neighboursOf = p =>
nearZero.map(n => [p[0] + n[0], p[1] + n[1]])
// arr.includes can't be used because [0, 0] !== [0, 0]
function later_ES5(delay) {
return new Promise(function(resolve) {
setTimeout(resolve, delay);
});
}
const later = delay => new Promise(resolve => setTimeout(resolve, delay))

Keybase proof

I hereby claim:

  • I am petrsnobelt on github.
  • I am petrsnobelt (https://keybase.io/petrsnobelt) on keybase.
  • I have a public key ASArKDLe2EpR9660uXM2KGil8RUrTa-lFa2CoSN8M0lxLAo

To claim this, I am signing this object:

@PetrSnobelt
PetrSnobelt / macbook-sw.txt
Last active April 24, 2021 05:49
Macbook software
Security
https://github.com/drduh/macOS-Security-and-Privacy-Guide#google-chrome
https://github.com/google/santa - A binary whitelisting/blacklisting system for macOS - consider
https://objective-see.com/index.html
Programming
SourceTree or GitKraken
VSCode
nodejs
@PetrSnobelt
PetrSnobelt / gist:212944c24b5e85a32327681ce7b05328
Last active December 6, 2017 18:20
Training materials for js, react and functional programming
React
https://blog.kentcdodds.com/learn-react-fundamentals-and-advanced-patterns-eac90341c9db
https://cdb.reacttraining.com/free-advanced-react-js-lectures-a9fdcad008f3
https://frontendmasters.com
@PetrSnobelt
PetrSnobelt / react-components.txt
Last active November 7, 2018 20:43
Nice react components
State
=====
Redux
Redux-Observables
Mobx
https://github.com/infinum/mobx-jsonapi-store
functional setState
xState
https://github.com/davidkpiano/xstate
@PetrSnobelt
PetrSnobelt / rss.xml
Created March 11, 2017 17:11
Sample Media Rss File
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Some Bands I Like</title>
<link>http://www.andyvolk.com/webmonkey/bands/</link>
<description>A list of some bands I like
(or have been a member of).</description>
<item>
<title>Rocking Webmonkey Garage Band</title>
<link>http://www.webmonkey.com/ourband.html</link>
<description>The best ever garage band on the Internet.</description>
@PetrSnobelt
PetrSnobelt / idle.js
Last active June 7, 2016 22:10
Get idle time from winapi
"use strict";
//based on https://github.com/electron/electron/issues/1528
const ref = require('ref');
const refStruct = require('ref-struct');
const refArray = require('ref-array');
//const ffi = require('ffi-atom-shell'); //failed to install
const ffi = require('ffi');