This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require("async"); | |
var _ = require("lodash"); | |
function deleteDocsFromView( db, designName, viewName, callback){ | |
async.waterfall([ | |
function( callback ){ | |
db.view(designName, viewName, function(err, data) { | |
if ( err ){ | |
return callback( err ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Update doc if exists, insert a new one if not | |
* @param: docId | |
* @param: callback(doc), return updated document by the caller | |
* @param: done( err, doc ) status callback | |
*/ | |
this.upsert = function( db, docId, callback, done ){ | |
var insert = function( body ){ | |
//Let caller modify doc if already exists, caller can replace with entirely new doc, however, doc id will be reestablished if doc already exists | |
var id = body && (body._id || body.id); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pixiedust.display.app import * | |
@PixieApp | |
class SamplePixieApp: | |
def foo(self): | |
print("Hello from a function defined in the app itself") | |
@route(clicked="true") | |
def _clicked(self): | |
self._addHTMLTemplateString("""<input option_clicked="false" type="button" value="You Clicked, Now Go back">""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1 = sqlContext.createDataFrame( | |
[(2010, 'Camping Equipment', 3, 200),(2010, 'Camping Equipment', 10, 200),(2010, 'Golf Equipment', 1, 240), | |
(2010, 'Mountaineering Equipment', 1, 348),(2010, 'Outdoor Protection',2,200),(2010, 'Personal Accessories', 2, 200), | |
(2011, 'Camping Equipment', 4, 489),(2011, 'Golf Equipment', 5, 234),(2011, 'Mountaineering Equipment',2, 123), | |
(2011, 'Outdoor Protection', 4, 654),(2011, 'Personal Accessories', 2, 234),(2012, 'Camping Equipment', 5, 876), | |
(2012, 'Golf Equipment', 5, 200),(2012, 'Mountaineering Equipment', 3, 156),(2012, 'Outdoor Protection', 5, 200), | |
(2012, 'Personal Accessories', 3, 345),(2013, 'Camping Equipment', 8, 987),(2013, 'Golf Equipment', 5, 434), | |
(2013, 'Mountaineering Equipment', 3, 278),(2013, 'Outdoor Protection', 8, 134),(2013,'Personal Accessories',4, 200)], | |
["year","zone","unique_customers", "revenue"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pixiedust.display.app import * | |
from pixiedust.apps.mapboxBase import MapboxBase | |
@PixieApp | |
class SFDashboard(MapboxBase): | |
def setup(self): | |
self.mapJSONOptions = { | |
"mapboxtoken": "XXXX", | |
"chartsize": "90", | |
"aggregation": "SUM", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<object type="text/html" data="https://davidclusterpaid.us-south.containers.mybluemix.net/embed/aaf70254-0069-483e-a641-46062041aac4/600/400" width="600" height="400"><a href="https://davidclusterpaid.us-south.containers.mybluemix.net/embed/aaf70254-0069-483e-a641-46062041aac4">View Chart</a></object> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%pixie_debugger | |
import random | |
def find_max (values): | |
max = 0 | |
for val in values: | |
if val > max: | |
max = val | |
return max | |
find_max(random.sample(range(100), 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%pixie_debugger -b find_max 9 | |
import random | |
def find_max (values): | |
max = 0 | |
for val in values: | |
if val > max: | |
max = val | |
return max | |
find_max(random.sample(range(100), 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pixiedust.display.app import * | |
@PixieApp | |
class TestApp(): | |
@route() | |
def main_screen(self): | |
return """ | |
<button type="submit" pd_options="badroute=true" pd_target="target{{prefix}}"> | |
Call bad Route | |
</button> | |
<div id="target{{prefix}}"></div> |