Skip to content

Instantly share code, notes, and snippets.

@ZachGawlik
ZachGawlik / README.md
Last active Feb 15, 2018
JavaScript Syntax Specifics
View README.md

JavaScript @ Bluecore (for curious backend devs)

Syntax

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
ZachGawlik / README.md
Created Jan 3, 2018
Codemods & ASTs talk outline
View README.md

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
ZachGawlik / README.md
Last active Jan 3, 2018
factory-to-create-element codemod v0.1
View README.md

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

Example

View keybase.md

Keybase proof

I hereby claim:

  • I am zachgawlik on github.
  • I am zachg (https://keybase.io/zachg) on keybase.
  • I have a public key ASBUEOP-Y10P9tw1QChMhSH1tr21OK6UnCb2k_-gwbAZ7Qo

To claim this, I am signing this object:

View init.coffee
# 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 ->