Skip to content

Instantly share code, notes, and snippets.

View illia108's full-sized avatar
🏠
Working from home

Illia Kuzma illia108

🏠
Working from home
  • Geologie
  • Canada
View GitHub Profile
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@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);
}
@bahelms
bahelms / merge_csv.rb
Last active May 9, 2022 19:46
Merge multiple csv files into one in Ruby
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|
@jordan-thoms
jordan-thoms / convertjsoncsv.rb
Last active December 15, 2022 21:51
Code to convert json to csv, with correct headings Usage: ruby convertjsoncsv.rb <input file> <output file>
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