Cynics Soapbox

Random thoughts...

postgrest lessons learned

I’ve been spending some time recently getting to grips with postgrest by writing a small schema and figuring out how it all sits together with the help of a simple python client. The plan is to continue to develop it as a react/redux app once I have postgrest and the data figured out 🙂 The following are just some things I’ve learned that may have helped me from 10 days ago and may help someone else. Roles I’...

Command line babel?

Babel is a great project and a really useful npm module. I’ve use it in almost all of my webpack experiments, but recently I had a need to use it from the command line. Thankfully there is the babel-cli module. However, things weren’t as simple as some of the blog posts I found suggested. Starting with a new project and npm the initial installation is the usual breeze. $ npm init -y $ npm install --save-dev babel-cli According to the...

Webpack: sass & import, names

Having started moving to sass for my project and including the required bits in my webpack configuration (blog post), the next issue I ran into was that importing didn’t seem to work as expected. Require not Import? One of the additions I made to my webpack config was to add a resolve section, allowing me to use more convenient and simpler require lines in my javascript. resolve: { modulesDirectories: ['node_modules', 'components', 'css', 'fonts'], extensions: ['', '.js', '.jsx',...

sass

Continuing my delve into React, webpack and so on and after adding a bunch of css files, I decided it was time to join the 21st century and switch to one of the css preprocessors. LESS was all the rage a few years ago, but now sass seems to have the mindshare and so I’m going to head down that route. Installing Oddly enough, it installs via npm 🙂 npm install --save-dev node-sass npm install --save-dev sass-loader Webpack Config The...

Webpack Dev Server

After using webpack for a few days, the attraction of changing to using the dev server are obvious. The webpack-dev-server is a little node.js Express server, which uses the webpack-dev-middleware to serve a webpack bundle. Install Oddly enough, it needs installed via npm! However, as we’re going to run it from the command line, we’ll install it globally. sudo npm install -g webpack-dev-server Running After install, simply running the server (in the same directory as the webpack....

React Mixins

Having written a simple test app I’m continuing to use it to try and develop my React knowledge 🙂 One aspect that I did find a little annoying was the amount of code I seemed to repeat. I kept thinking that I should have a base class and simply inherit from it – a pattern I have used a lot in other languages, but this is React and nothing I had seen suggested that pattern. Enter the Mixin A react mixin...

React Lessons Learned

I’ve been playing with React for a few days now and, as always, have run across a few things that made me scratch my head and seek help from various places. In an effort to capture some of the errors and mistaken assumptions I have made, I’ll try and show them in a very simple way below. As always, comments and suggestions for improvement are more than welcome. A Simple Page To try and show the issues I...

More Webpack

Following on from yesterdays experiments with webpack and react, I’ve changed things round a little today in an effort to make things even simpler. webpack.ProvidePlugin One of the annoying aspects of splitting the single file into smaller pieces was the need to add the require lines to every one. I thought there must be a simpler way – and there is! The ProvidePlugin allows you to tell webpack that certain requires should be added as needed. To use it...

Starting with React & Webpack

In recent days I’ve been working on a small single page JS app using React and bootstrap. After getting over my initial issues yesterday saw a lot of progress and I’m finding it far simpler to work with React than almost any other JS “thing” I’ve tried. However, (you knew it was coming didn’t you?) at present my single page app is just that – a monster of a single HTML file with a bunch of required...

Building postgrest

I’ve long thought that a simple REST layer sitting on top of a database, with some suitable access controls would be an ideal solution for many of the small projects I find myself tinkering with. Until recently I’d never quite found a solution that provided this, but then I came across postgrest. Having some time to spend looking at it and the base of an idea that might be ideally suited to using it, I decided to install....

afpfs-ng

At home we use atalk for the shares on the Home Media Server. It makes things simpler as there are Apple computers around. The client I use for Ubuntu is afpfs-ng by Simon Vetter. Having built it a few times (old school, eh?!) I find myself having to relearn the package dependancies, so this post is intended to fix that. The box already has the build-essentials package installed. Before running configure for afpfs-ng I needed to install libfuse and it’...

Broccoli

It’s fair to say that when it comes to the modern world of javascript, I’m something of a luddite. It’s not a world I’ve spent a lot of time with and while looking at options to start projects much of what I read may as well be double dutch. However, I have spent some time and EmberJS is slowly become more familiar and useful. So, now that I’m writing apps, the next step in my...