Archive

Simple debounce.js function minified

export default function debounce(a,b,c){var d,e;return function(){function h(){d=null,c||(e=a.apply(f,g))}var f=this,g=arguments;return clearTimeout(d),d=setTimeout(h,b),c&&!d&&(e=a.apply(f,g)),e}}

Asar

Asar electron “tarball”

# Open terminal and install asar node module globally
$ npm install -g asar
# Go into the app’s directory, in our case it’s Slack
$ cd /Applications/Slack.app/Contents/Resources
# Create a directory to paste the content of app
$ mkdir example-sourcecode
# Unpack the app.asar file in the above directory using asar
$ asar extract app.asar example-sourcecode
# Boom cd into it and see the source code of the app

Redux, Selectors

Always use a selector to get state from components.

export const getAudio = (state) => {
return {
audio_folder: state.audio_folder,
playing: state.playing
}
}

Linux, Debian remove / stop service

To stop a service
sudo service servicename stop

To disable service autostart
sudo update-rc.d servicename disable

Git prevent from asking username and password everytime

Don’t use HTTP use SSH instead

change

https://github.com/WEMP/project-slideshow.git

to

git@github.com:WEMP/project-slideshow.git

you can do it in .git/config file