Skip to content

Instantly share code, notes, and snippets.

kof /
Last active Mar 7, 2021
Complete wipe of all node related files for MacOS
yarn cache clean
npm cache clean --force
sudo rm -rfv /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
sudo rm -rfv ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.yarnrc ~/.node_repl_history
sudo rm -rfv /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rfv /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
sudo rm -rfv /usr/local/include/node /usr/local/include/node_modules
sudo rm -rfv /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
sudo rm -rfv /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
kof / Switch1.js
Last active Jan 27, 2020
Material-UI Switch using imaginary state machine
View Switch1.js
// Original implementation
// An attempt to use state machines inside of styles declaration.
const useStyles = createUseStyles({
root: {
display: 'inline-flex',
overflow: 'hidden',
boxSizing: 'border-box',
position: 'relative',
flexShrink: 0,
kof / button-hooked.js
Last active Nov 23, 2021
Inject styles with custom hooks
View button-hooked.js
const styles = {
button: {
color: 'red'
const Button = () => {
const {classes} = useStyles(styles)
return <button className={classes.button}>Test<Button>
kof / example.js
Created Jul 11, 2018
static jss as a raw css string
View example.js
// source js
const styles = {
static: {
color: 'green'
mixed: {
color: 'red',
margin: (props) => props.spacing
kof / structure.txt
Last active Jun 26, 2018
Redux app structure
View structure.txt
- components
- utils
- feature-x
- action-types
- action-creators
- reducer
- containers
- renderers
- index.js
kof / react-component.js
Last active Aug 30, 2017
Reactive Component
View react-component.js
class MyComponent extends Component {
componentWillMount() {
alert('will mount')
onClick = () => {
alert('Button Clicked')
// Forward click to the outer listeners.
kof /
Last active Jul 17, 2017
weird linked-in conversation

Jul 5 LinkedIn Member sent the following message at 7:19 PM LinkedIn Member Hi Oleg

We are a 12 person team of young professionals building our own company in Berlin. We are looking for another Reactjs developer to cofound with us. Would you like to hear more about it?

Best regards, Josh

kof /
Last active Jul 3, 2017
External things that keep me motivated at work
  1. Open Source being officially part of the job, not just an "after job fun" instead of spending time with the family.
  2. Colleagues one can learn from, not those one needs to clean up after.
  3. Money matters. Only a stupid person can think that money doesn't matter in our capitalistic society. This also includes social security, medical ensurance and any other expenses. I am not mercantile, no.
  4. Soft deadlines. Having time to do things right.
  5. No pressure in being at time every day in the office. We all got our issues.
  6. Workout during working hours. Possibility to go quickly for a run or to the gym.
  7. Office is optional. I prefer to work from any location I want. Sometimes being in the office is nice though.
  8. Good sitting conditions: good chairs, gym ball, stay desk, sofas.
  9. Relaxation room or nap room.
kof / detect-rendered-css.js
Created May 28, 2017
Detect Rendered CSS using a probe container.
View detect-rendered-css.js
// This allows you to benchmark CSSinJS libs after styles have been really applied.
function detectCSSRendered(className, callback) {
const probe = document.createElement('div') = 'hidden'
probe.className = className
var style = document.head.appendChild(document.createElement('style'))
style.textContent = '' +
'@keyframes probe-animation {' +
' from {left: 20%}' +
kof / confirm-linkedin-skills.js
Last active Jul 8, 2017
Confirm all skills at linkedin
View confirm-linkedin-skills.js
var expander = document.querySelector('[data-control-name="skill_details"][aria-expanded="false"]')
if (expander)
;[].slice.apply(document.querySelectorAll('button[data-control-name="endorse"]')).forEach((btn) => {