Skip to content

Instantly share code, notes, and snippets.

View steniowagner's full-sized avatar
:electron:
“Every programmer is an author.” - Sercan Leylek

Stenio Wagner steniowagner

:electron:
“Every programmer is an author.” - Sercan Leylek
View GitHub Profile
// @flow
import React, { PureComponent } from 'react';
import {
TouchableWithoutFeedback,
Animated,
Easing,
Image,
} from 'react-native';
import { Dimensions, Platform, PixelRatio } from 'react-native';
const { width, height } = Dimensions.get('window');
const getWidthFromDP = (widthPercentage) => {
const percentageDesired = parseFloat(widthPercentage);
const widthPercentageToDP = PixelRatio.roundToNearestPixel((width * percentageDesired) / 100);
return widthPercentageToDP;
};
import pandas
import datetime
import numpy
import math
import csv
from scipy.stats import laplace
dataset = pandas.read_csv('income.csv', skiprows = 1, header = None, names = ['name', 'age', 'city', 'state', 'income'])
cities = set(dataset['city'])
import pandas
import datetime
import numpy
import math
import csv
dataset_background = pandas.read_csv('background.csv', skiprows = 1, header = None, names = ['nome', 'genero', 'data_nascimento', 'cidade', 'estado'])
dataset_diseases = pandas.read_csv('doencas.csv', skiprows = 1, header = None, names = ['genero', 'data_nascimento', 'cidade', 'estado', 'doenca'])
dataset_diseases_size = len(dataset_diseases)
import pandas
import datetime
import numpy
import math
import csv
dataset = pandas.read_csv('epidemias.csv', skiprows = 1, header = None, names = ['nome', 'genero', 'data_nascimento', 'cidade', 'estado', 'doencax'])
dataset_size = len(dataset)
import pandas
import datetime
import numpy
import math
import csv
from random import randint
dataset = pandas.read_csv('epidemias.csv', skiprows = 1, header = None, names = ['nome', 'genero', 'data_nascimento', 'cidade', 'estado', 'doencax'])
dataset = pandas.read_csv('epidemias.csv', skiprows=1, header=None, names=['nome', 'genero', 'data_nascimento', 'cidade', 'estado', 'doencax'])
cities = set(dataset['cidade'])
states = set(dataset['estado'])
def get_gender_value(raw_gender):
gender = raw_gender.to_string()
index_substring = gender.rfind(' ') + 1
return 0 if gender[index_substring:] == 'Female' else 1
@steniowagner
steniowagner / app.js
Created February 27, 2018 01:55
Snippet that use the redux-persist + redux-saga. You can find the full setup here: https://gist.github.com/steniowagner/b3c9e1dccfea7bf61d585020232b3c97
import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import { View } from 'react-native';
import { store, persistor } from './store';
const App = () => (
@steniowagner
steniowagner / store.js
Last active March 10, 2022 15:25
Basic setup of Redux-Store + Redux-Persist + Redux-Saga. You can find a snippet that use this configuration here: https://gist.github.com/steniowagner/e778fcae0d8eb77b82da983fb46c2826
import { createStore, applyMiddleware, compose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { persistStore, persistCombineReducers } from 'redux-persist';
import storage from 'redux-persist/es/storage';
import rootSaga from './sagas';
/* Reducers */
// Adicionando um user, isso é equivalente a um POST do REST
mutation {
addUser (userid:"24", name:"joao victor", age: 23) {
// Esses parâmetros são o que tu quer saber após o POST
userid
name
age
}
}