Skip to content

Instantly share code, notes, and snippets.

@ryaninvents
Last active February 21, 2018 16:47
Show Gist options
  • Save ryaninvents/a47bbe1e3db72cb13196 to your computer and use it in GitHub Desktop.
Save ryaninvents/a47bbe1e3db72cb13196 to your computer and use it in GitHub Desktop.
Today I learned

Computers and software

Networking

DNS

  • Setting a CNAME on a particular subdomain implies that an interested party should look at the other resource for ALL data referring to that subdomain. As such, it will "shadow" any other records, such as MX records, on that subdomain. This is why email breaks when you use CNAME on an apex domain. source 2016-02-12

Applications

  • Chrome Canary does not allow you to set itself as the default browser from within the Chrome settings, claiming "This is a secondary installation of Google Chrome, and cannot be made your default browser". Well, with that attitude, of course it can't! On MacOS, go to System Preferences > General, and you'll see a dropdown for default browser where you can indeed choose Canary. 2018-02-06

Git

  • Sometimes, it's necessary to rewrite history after a merge has already been performed using the commits you wish to modify. git rerere may help here (note: I have not tested this, I just want to hang onto this info for next time). (source: StackOverflow) 2018-02-20

Bash

  • Handy function for diffing two directories, but only checking for the existence of files (ignoring content changes):

    function diff-extant {
      vimdiff <(cd "$1"; find . | sort) <(cd "$2"; find . | sort)
    }

    Usage: diff-extant ./src ../other-repo/src. 2018-02-21

JavaScript

Dependency management

  • The serverless package depends on graphql, which was why my GraphQL server was failing with the error message:

    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of other
    relied on modules, use "resolutions" to ensure only one version is installed.
    

    The solution is to only install serverless globally and not as a devDependency. 2018-01-17

React

react-dnd

  • react-dnd (specifically the HTML5 backend) effectively sets draggable="true" on the top-level draggable DOM node. However, if you are rendering a complex component into the draggable item and you want the entire thing to be draggable, you have to explicitly set draggable="true" in the JSX. 2018-01-26; see draggable on MDN for more

gatsby

  • If you get an error Unexpected token: name (context) related to striptags.js from using the Gatstrap starter site, then you need to remove the striptags related code from blog-post.js. 2018-01-17

Code style

  • Found a good example of why I strongly prefer semicolons. This sort of thing likely cost someone quite a bit of time. 2018-01-19

Browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment