Skip to content

Instantly share code, notes, and snippets.

View mafraba's full-sized avatar

Manuel David Franco Barrios mafraba

View GitHub Profile
const Storage = require('@google-cloud/storage')
const storage = new Storage({
projectId: 'myproject',
customEndpoint: true
})
const googleStorageUrl = 'https://www.googleapis.com/storage/v1'
storage.interceptors.push({
@mafraba
mafraba / flatten_array.rs
Created September 26, 2017 18:57
Flatten arbitrarily nested arrays in Rust
/* Required some Rust code to flatten an array of arbitrarily nested arrays of integers into a flat array of
* integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
*/
/* Model of an arbitrarily nested array of arrays, since native arrays in Rust won't allow that.
* It is a generic type so that it supports all native numeric types.
*/
enum ArbitrarilyNestedArray<T> {
Array(Vec<ArbitrarilyNestedArray<T>>),
Integer(T)