Skip to content

Instantly share code, notes, and snippets.

ZachGawlik /
Last active February 15, 2018 21:29
JavaScript Syntax Specifics

JavaScript @ Bluecore (for curious backend devs)


Shorthand madness

The newer javascript specs include many syntax shorthands. The following are all equivalent, defining a function that creates an object with a specified title and the option to define a non-default list.

ZachGawlik /
Created January 3, 2018 17:56
Codemods & ASTs talk outline

Codemods & Underlying tech powering frontend today

What is a codemod?

  • Definition
    • A tool for large-scale codebase refactors. In this case, it's a script that is run against the files you wish to change
    • When regex/find and replace isn't enough. Needing the context of the surrounding code and its meaning
  • How? Abstract Syntax Trees!
ZachGawlik /
Last active January 3, 2018 02:50
factory-to-create-element codemod v0.1

Converts factory-style React to React.createElement style. This can then be fed to react-codemod's create-element-to-jsx. Along the way, it'll also add a React import when needed and remove react-dom-factories imports.

Run using jscodeshift like so:

jscodeshift -t /path/to/factory-to-create-element.js /directory/to/transform/**/*.js


# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->

Keybase proof

I hereby claim:

  • I am zachgawlik on github.
  • I am zachg ( on keybase.
  • I have a public key ASBUEOP-Y10P9tw1QChMhSH1tr21OK6UnCb2k_-gwbAZ7Qo

To claim this, I am signing this object: