Skip to content

Instantly share code, notes, and snippets.

View isc-rsingh's full-sized avatar

Raj Singh isc-rsingh

View GitHub Profile
# Deletes documents returned from a view named 'badones' in a design document named 'logging'
# The view must emit doc._id as the key. Here's an example design document
# function (doc) {
# var badword = 'mistake';
# if (doc.anotherprop && doc.anotherprop.substr(0, badword.length) === badword) {
# emit(doc._id, doc.anotherprop);
# }
# }
import requests
@isc-rsingh
isc-rsingh / geotest.js
Last active July 26, 2016 16:26
A simple Node.js script to test Cloudant geo queries for load and/or coverage. `npm install superagent` then `node geotest.js`
var request = require('superagent');
// Replace these 3 variables with your own information
// Note: The database must be world readable
const CLOUDANT_ACCOUNT = 'opendata';
const CLOUDANT_DB = 'pois';
const GEO_INDEX = '_design/idx/_geo/spatial';
for (var index = 0; index < 500; index++) {
runQuery(index)
@isc-rsingh
isc-rsingh / pixiedust_display-table-init-v0.7.py
Last active January 4, 2017 16:09
pixiedust __init__.py in dir display/table
@PixiedustDisplay(isDefault=True)
class TableDisplayMeta(DisplayHandlerMeta):
@addId
def getMenuInfo(self,entity, dataHandler):
if dataFrameMisc.isPySparkDataFrame(entity) or dataFrameMisc.isPandasDataFrame(entity):
return [
{"categoryId": "Table", "title": "DataFrame Table", "icon": "fa-table", "id": "dataframe"}
]
elif dataFrameMisc.fqName(entity) == "graphframes.graphframe.GraphFrame":
return [
@isc-rsingh
isc-rsingh / pixiedust_display-table-display-v0.7.py
Created January 4, 2017 16:10
pixiedust display.py in dir display/table
class TableDisplay(Display):
def doRender(self, handlerId):
entity=self.entity
if dataFrameMisc.fqName(entity) == "graphframes.graphframe.GraphFrame":
if handlerId == "edges":
entity=entity.edges
else:
entity=entity.vertices
if dataFrameMisc.isPySparkDataFrame(entity) or dataFrameMisc.isPandasDataFrame(entity):
self._addHTMLTemplate('dataframeTable.html', entity=PandasDataFrameAdapter(entity))
@isc-rsingh
isc-rsingh / dataframeTable.html
Created January 4, 2017 16:36
pixiedust dataframeTable.html in dir display/table/templates
<style type="text/css" class="pd_save">
.df-table-wrapper .panel-heading {
border-radius: 0;
padding: 0px;
}
.df-table-wrapper .panel-heading:hover {
border-color: #008571;
}
.df-table-wrapper .panel-title a {
background-color: #f9f9fb;
@isc-rsingh
isc-rsingh / SimpleDisplayMeta.py
Created January 4, 2017 19:29
pixiedust SimpleDisplayMeta.py in dir display/table
from .SimpleDisplay import SimpleDisplay
from ..display import *
import pixiedust.utils.dataFrameMisc as dataFrameMisc
@PixiedustDisplay()
class SimpleDisplayMeta(DisplayHandlerMeta):
@addId
def getMenuInfo(self,entity,dataHandler):
if dataFrameMisc.isPySparkDataFrame(entity) or dataFrameMisc.isPandasDataFrame(entity):
return [
@isc-rsingh
isc-rsingh / index.html
Last active February 14, 2017 22:27
mapbox symbol styling
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@isc-rsingh
isc-rsingh / LICENSE.txt
Last active May 2, 2017 15:14
Analyze Boston geographic open data sets
------------------------------------------------------------------------
Copyright IBM Corp. 2017
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@isc-rsingh
isc-rsingh / Cycling through History.md
Last active May 9, 2017 18:30
cycling through history site

Cycling through History

{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[-81.54453, 28.37968],
[-81.54517, 28.37869],
[-81.54594, 28.37742],
[-81.54615, 28.37686],
[-81.54635, 28.37677],