Skip to content

Instantly share code, notes, and snippets.

View poteirard's full-sized avatar
🤍

Gerard Brull poteirard

🤍
View GitHub Profile
@poteirard
poteirard / snakify.js
Created December 14, 2017 14:24 — forked from incik/snakify.js
Transform camelCase keys of an object into snake_case
function snakifyKeys(fields) {
// because this function can receive map of ArrayNodes, we have to do this
let jsonFields = JSON.parse(JSON.stringify(fields));
for (let key in jsonFields) {
if (jsonFields[key] instanceof Object) {
// we need to go deeper!
jsonFields[key] = snakifyKeys(jsonFields[key]);
}
@poteirard
poteirard / 0_reuse_code.js
Created December 31, 2015 14:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console