This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import axios, { post } from 'axios'; | |
class SimpleReactFileUpload extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
file:null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takes and array of arrays matrix and return an array of elements. | |
function flatten(arrayOfArrays){ | |
return [].concat.apply([], arrayOfArrays); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
def csv_headers | |
["Your", "Headers", "Here"] | |
end | |
files = Dir["file_names_*.csv"].sort_by { |f| "if you want to sort the files" } | |
file_contents = files.map { |f| CSV.read(f) } | |
csv_string = CSV.generate do |csv| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'json' | |
require "set" | |
json = JSON.parse(File.open(ARGV[0]).read)["results"] | |
# Pass 1: Collect headings | |
headings = SortedSet.new | |
json.each do |hash| | |
headings.merge(hash.keys) | |
end |