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
UserController.prototype.getUserFeed = function(request, response, next) {
var _id = request.params._id;
var context = this;
this.model.findOneAsync(_id)
.then(handleNotFound)
.then(function(user) {
return user;
})
.then(function(user) {
import React from 'react'
import { render } from 'react-dom'
import { BrowserRouter } from 'react-router-dom'
import App from './app'
render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.querySelector('[data-js="app"]')
import React, { Component } from 'react';
import {
StyleSheet,
View,
PermissionsAndroid,
Platform,
} from 'react-native';
import MapView from 'react-native-maps';
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 };
calculateDistanceBetweenCoordinates = (firstCoordinate, secondCoordinate) => {
const PI = 0.017453292519943295;
var haversine = 0.5 - Math.cos((secondCoordinate.latitude - firstCoordinate.latitude) * PI) / 2 +
Math.cos(firstCoordinate.latitude * PI) * Math.cos(secondCoordinate.latitude * PI) *
(1 - Math.cos((secondCoordinate.longitude - firstCoordinate.longitude) * PI)) / 2;
return 12742 * Math.asin(Math.sqrt(haversine)); // 2 * EARTH_RADIUS (6371);
}
import numpy as np
import matplotlib.pyplot as plt
results = [128.404195237, 97.3462196942, 97.32592423, 77.4317551694]
clusters_points = [2, 3, 4, 5]
plt.xlim([2, 5])
plt.ylim([50, 140])
plt.plot(clusters_points, results, 'go') # bolinha verde
plt.plot(clusters_points, results, 'k:', color='blue') # linha pontilhada
import numpy as np
import matplotlib.pyplot as plt
results = [128.404195237, 97.3462196942, 97.32592423, 77.4317551694]
clusters_points = [2, 3, 4, 5]
plt.xlim([2, 5])
plt.ylim([50, 140])
plt.plot(clusters_points, results, 'go') # bolinha verde
plt.plot(clusters_points, results, 'k:', color='blue') # linha pontilhada
#include <stdio.h>
#include <stdlib.h>
main()
{
int anos;
printf("\nDigite o anos dos casados: ");
scanf("%d",&anos);
// 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
}
}
@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 */