Skip to content

Instantly share code, notes, and snippets.

@MauricioMoraes
MauricioMoraes / one_level_flatten.js
Created October 22, 2015 12:00
Javascript Flatten (for one level nested arrays) - Useful for google apps scripts on spreadsheets
// Takes and array of arrays matrix and return an array of elements.
function flatten(arrayOfArrays){
return [].concat.apply([], arrayOfArrays);
}
@ngalluzzo
ngalluzzo / copyrecord.js
Last active October 25, 2022 18:23
Copy a Record!
// I took one of Knack's examples and tweaked it a bit to duplicate my own records since I needed this ASAP.
// This example works off of a record's detail view to access the data. I have not worked up a table solution yet.
// TODO: - Add connected records
// Change your view
$(document).on('knack-view-render.view_12', function (event, view, data) {
// Map new record fields with current record in view
var duplicateData = {
// If field is connection, we need to match the ID in order for Knack to pick it up
field_57: data.field_57_raw[0].id,