Home Automation with Home Assistant Apr 26, 2019 What is it? Home Assistant is an open source home automation platform. Conceptually it is a central platform that can communicate with smart home devices (such as lights, motion detectors, alarm systems, thermostats and much more). For people familiar with smart home devices, the most annoying problem with them is every manufacturer has a different app to control their devices. Since I have Wemo switches, TP Link switches and Hue lights, I need to constantly switch between the 3 apps to control my home. ...
VSCode tips Apr 08, 2019 Keyboard Shortcuts Command Shortcut Toggle sidebar Ctrl+B Quick Fix Ctrl+. Open Settings Ctrl+, Indent/Outdent Ctrl+[, Ctrl+] Vim Bindings Shortcuts Command Shortcut Show tooltip gh Text reflow (on selection) gq Jump to definition gd Autocomplete and Linting in Python Create a . ...
Dockerise Wordpress Apr 07, 2019 Rationale A friend of mine has a startup and is after a Wordpress site that is easy to maintain. His startup is looking at developing a suite of small web applications to compliment the site, with that in mind I chose to build it with Docker, as it low maintenance, easy to change hosting providers and easy to host applications side by side. What is Docker Docker makes it easier to develop and deploy applications by using containers (which are kinda like virtual machines, but more lightweight). ...
Crafting Restful APIs Mar 02, 2019 Resources Resources represent an entity, for example a car, building, person, etc. I usually use name my resources as plural, as most of the time I’m working with a collection of entities. Its easiest to think of your API like a database, it is used to create, read, update or delete data. HTTP Verbs HTTPS verbs describe the action thats going to take place, for example: - GET: Used for retrieving resources - POST: Used for creating resources - PUT: Used for updating resources - DELETE: Used for deleting resources ...
Dev Cheatsheet Mar 02, 2019 A collection of useful commands that I use frequently Git Managing profiles There is a neat way to manage multiple git profiles, mainly the email address. git config --global alias.work 'config user.email "roy@work"' git config --global alias.personal 'config user.email "roy@home"' Then within a project, run git work or git personal to set the local git profile. Bash Vim Spell Checking Enable spell checking with: :se spell Spelling corrections will be underlined, to fix a spelling error, move the cursor over it and press z=, then select the option from the list. ...
Hashbangs Mar 02, 2019 Making scripts executable in Linux is as easy as setting a line at the top of the script, below is a list of common ones: File Type Line Python #!/usr/bin/env python3 Node #!/usr/bin/env node Shell #!/usr/bin/env bash Once the hashbang is added to the top of the file, make the file executable by doing chmod +x your_file. ...
React Performance Mar 02, 2019 Below is a dot point list of performance tips for React, will be turned into a proper post when I have time… From the React Docs Virtualize long lists (a.k.a react-window) Avoid Reconciliation Highlight Updates in React Dev Tools Use PureComponent to prevent unnecessary updates (shallow prop and state comparison) Prevent parent components from unnecessarily updating child components Avoid mutating data Mutating data means that the UI rerenders (reconciliation) Use immutable data structures Immutable data structures makes tracking changes cheap, as we can do shallow comparison of objects Structural sharing? ...
Setting up CORS with Python Mar 02, 2019 What is CORS? CORS (Cross Origin Resource Sharing) allows access to resources from other domains, a good use case for this is a web app trying to fetch data from an API on another domain. CORS is only required when trying to fetch data from a browser, as browsers by default will block requests to different origins (domains). CORS uses HTTP headers to tell the browser if it has permission to fetch the resources. ...