Skip to content

Instantly share code, notes, and snippets.

View rxluz's full-sized avatar

Ricardo Luz rxluz

View GitHub Profile
const fs = require('fs');
const fastCsv = require('fast-csv');
var fileStream = fs.createReadStream("machineData_clean_Cafe.csv"),
parser = fastCsv();
fileStream
.on("readable", function () {
var data;
while ((data = fileStream.read()) !== null) {
render(){
 return (
 <div>
 <h1>Hey I am an element</h1>
 <i>And I am other element</i>
 </div>
);
}
render(){
return [ //you need change ( to [
<h1 key="element-1">Hey I am an element</h1>, //each element must have a key and a comma in the end
<i key="element-2">And I am other element</i>
];
}
render(){
return (
<>
<h1>Hey I am an element</h1>
<i>And I am other element</i>
</>
);
}
array.reduce(
(accumulator, field) => { your logic },
accumulatorInitialValue
)
const initialArray = [10, 20, 10, 20];
const result = initialArray.reduce(
(amount, value) => amount + value
);
let amount = 0;
for (v of [3, 4, 60, 7, 9, 10]) {
 amount+=v;
}
const initialArray = [
{
name: 'Ricardo',
surname: 'Luz',
age: 32
},
{
name: 'John',
surname: 'Doe',
age: 40
@rxluz
rxluz / translationsUsingJson.json
Created December 13, 2017 20:51
Example of translations using json strings
{
"ACTION_ACTIVE":"Aktiv",
"ACTION_CANCEL":"Cancel",
"ACTION_ADD":"Hinzufügen",
"ACTION_ADD_CUSTOMER":"Neuen Kunden hinzufügen",
"ACTION_BACK_TO_MENU":"Zurück zum Menü",
"ACTION_BACK_TO_LIST":"Zurück zur Liste",
"ACTION_CHECK":"Klick zum prüfen",
"ACTION_CHECK_NO_CV":"Keine CVV für diese Karte generieren",
"ACTION_CHECKOUT":"Check-out",
@rxluz
rxluz / reducers.jsx
Created December 13, 2017 21:05
Implementing i18n in your application
import {i18nState} from "redux-i18n"
// with Immutable.js:
import {i18nState} from "redux-i18n/immutable"
const appReducer = combineReducers({
otherreducers,
i18nState
})