• Re-blah: Server Setup Guide

    Context

    This guide is crazy legit for setting up a/multiple django servers. It leaves you with a very easy to understand file structure for your projects. I plan on making a boilerplate/cookiecutter template for this. 🤔

    Here it is.

  • Links and Symbols

    Context

    The best practice with nginx configurations is to have separate folders for sites-available and sites-enabled then just include the latter folder in your nginx.conf file. sites-available is where your confs are. sites-enabled just has symlinks to the ones in the other folder. It’s important you do the symlink right. If it’s broken, nginx will read an empty file and not throw any error at you. Yup, so basic. I’m ashame. Ahuhu.

    Lesson

    You symlink by doing the following command:

    ln -s source_file target_file

    Make sure it’s the absolute path. You should be able to nano or vi the symlink as you would the source file.

  • On Software Identities

    Context

    I moved a virtual environment to a different folder. This was before I did any pip operations so the problem was not immediately apparent. When you create and activate a VE, it stashes the location of your original softwares and exports the ones inside it–namely, pip and python. So because I moved the whole VE, the activate scripts failed to export the VE softwares.

    Lesson

    When you’re skeptical of which version of what software/command/script you’re using, use these two commands:

    type -a command

    or

    whereis program

  • About SVGs and Loaders

    Recently, I read about how github was doing away with font icons in favor of SVGs. Here’s how I went about implementing it for one of my side projects.

    Copy the svg you want from the octicons repo into your project’s assets folder or something similar.

    You can, of course, just paste the svg code manually to your html but they’re very unwieldly. Open one up and see how the path attribute is a bit too long to be reasonably maintainable. Github recommended a helper function in their post. It’s a tedious process with the way jsx is parsed a bit differently from html.

    npm install react-svg-loader (repo)

    Apparently, you can use a loader to specifically handle your svg files. This one in particular is straightforward. react-svg-loader just loads your svg files into something React-readable (e.g., camelCased classnames).

    Usage

    var Image1 = require('react-svg?es5=1!./image1.svg');
    // or
    var Image2 = require('babel!react-svg!./image2.svg');
    
    // and use it as
    <Image1 width={50} height={50}/>
    <Image2 width={50} height={50}/>

    Check the full instructions over at the repo.

  • The Post-ballpit Nap.

    Part One. Waiting

    Part Two. Standing-by

    Part Three. Ballpit

    Part Four. Chicken Dinner

    Part Five. Nap Time

  • You found me.

    I’ll try to update this thing once or twice a week.