Skip to content

Instantly share code, notes, and snippets.

View codeofsumit's full-sized avatar
👨‍💻
Working on parqet.com

Sumit Kumar codeofsumit

👨‍💻
Working on parqet.com
View GitHub Profile
/**
* this function will abbreviate a number to a string
* It's only for charts as it takes into account the label range
* and shortens accordingly.
*
* @param {Number} value
* @param {Number} min
* @param {Number} max
* @param {Number} minimumFractionDigits
* @param {Number} labelCount
import gql from 'graphql-tag';
import { client } from './apollo'
// const { createDBConnection } = require('./mongo')
const getActivity = async (portfolio) => {
const q = gql`
query ActivityByPortfolioId($portfolio: String!) {
activityByPortfolioId(portfolio: $portfolio, _size: 9999) {
data {
_id
<template>
<div class="page section">
<div class="hero is-large">
<div class="hero-body">
<center>
<h3 class="is-size-4">
<button class="button is-loading is-white"></button>
<span>Moment kurz ☕</span>
</h3>
</center>
{
"type": "Feature",
"properties": {
"radius": 443.0003055263856,
},
"geometry": { "type": "Point", "coordinates": [-74.008317, 40.72251] }
}
@codeofsumit
codeofsumit / layerFromJson.js
Last active January 2, 2019 12:29
Create a leaflet layer from geoJSON supporting circles
import { forEach } from 'lodash';
createLayersFromJson(data) {
const layers = [];
forEach(data, (geo, id) => {
L.geoJSON(geo, {
pointToLayer: (feature, latlng) => {
if (feature.properties.radius) {
return new L.Circle(latlng, feature.properties.radius);
@codeofsumit
codeofsumit / layerToJson.js
Last active January 2, 2019 12:25
Leaflet Circle to GeoJSON
transformLayerToJson(layer) {
const json = layer.toGeoJSON();
if (layer instanceof L.Circle) {
json.properties.radius = layer.getRadius();
}
return json;
}
describe('Draw & Edit Polygons', () => {
it('correctly draws a polygon', () => {
cy.toolbarButton('polygon').click();
cy.get('#map')
.click(390, 250)
.click(400, 50)
.click(450, 50)
.click(450, 150)
describe('Draw & Edit Polygons', () => {
it('correctly draws a polygon', () => {
// nothing yet
});
});
describe('Draw & Edit Polygons', () => {
it('correctly draws a polygon', () => {
cy.toolbarButton('polygon')
.closest('.button-container')
.should('have.not.class', 'active');
cy.toolbarButton('polygon')
.click()
.closest('.button-container')
describe('Draw & Edit Polygons', () => {
it('correctly draws a polygon', () => {
cy.toolbarButton('polygon')
.closest('.button-container')
.should('have.not.class', 'active');
cy.toolbarButton('polygon')
.click()
.closest('.button-container')