Skip to content

Instantly share code, notes, and snippets.

How to make a script to run in your terminal

  • Locate the path to the interpreter for the language you are writing in with the which command.

      which node
      which python
      which bash
      which ruby
    
  • Add that path as an interpreter directive (using #!) on the first line of your script. For example if which node returned /usr/local/bin/node, the first line of your script should be:

@roppa
roppa / conform.js
Last active August 29, 2015 14:16
Make all objects in an array have the same attributes
/**
Conform. We have a collection of objects with the possibility of having unique attributes.
We would like to ensure that each object in the collection has the same attributes. Handy for passing objects
to a CSV function that expects all objects to conform:
Example: var coll = [{a : "a", b : ""}, {a : "a", c : "c"}, {a : "a", d : "d", f : "f"}];
conform(coll);
@param array array of objects.
*/