I have a JSON based api http://localhost:3000/dashboard/get_timings?project_id=${project_id}&identifier=${metric_name}&start_time=${iso8601_date}&end_time=${iso8601_date} that returns a set of values associated with a timestamp.
The response format is {"timings": [{"timestamp": iso8601_date, "value": float_value}, ...]}
Generate a web page that shows a line chart loading the data from such an API.
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
std::vector<Int64Builder> builders(num_chunks); | |
ChunkResolver index_resolver(values.chunks()); | |
for (int64_t requested_index = 0; requested_index < num_indices; ++requested_index) { | |
uint64_t index = poc_get_index(indices, requested_index); | |
ChunkLocation resolved_index = index_resolver.Resolve(index); | |
int64_t chunk_index = resolved_index.chunk_index; | |
if (chunk_index < 0) { | |
// ChunkResolver doesn't throw errors when the index is out of bounds |
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 wsgiref.simple_server import make_server | |
import tg | |
from tg import RestController, expose, validate, MinimalApplicationConfigurator | |
from formencode import validators | |
class RootController(RestController): | |
@expose('json') |
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
export class HelloWorld extends React.Component { | |
render() { | |
return ( | |
<div className="helloworld"> | |
Hello {this.props.name} | |
</div> | |
); | |
} | |
} |
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
export class HelloWorld extends React.Component { | |
render() { | |
return ( | |
<div className="helloworld"> | |
Hello {this.props.name} | |
</div> | |
); | |
} | |
} |
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 tg import expose, TGController, AppConfig | |
from wsgiref.simple_server import make_server | |
make_server('', 8080, AppConfig( | |
minimal=True, | |
root_controller=type('RootController', (TGController,), { | |
'index': expose()(lambda *args, **params: 'Hello World') | |
})() | |
).make_wsgi_app()).serve_forever() |
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 tg.appwrappers.base import ApplicationWrapper | |
class OpBeatApplicationWrapper(ApplicationWrapper): | |
def __init__(self, handler, config): | |
super(OpBeatApplicationWrapper, self).__init__(handler, config) | |
from tg.support.converters import aslist | |
import logging | |
log = logging.getLogger('opbeat') |
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
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, print_function | |
from webassets.filter import Filter | |
__all__ = ('BabelJS',) | |
# NOTE: When using the BabelJS compiler for code | |
# that needs to run in the browser make sure to add | |
# https://cdnjs.cloudflare.com/ajax/libs/babel-core/4.6.6/browser-polyfill.js |
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
TurboGears2 exception logging and performance monitoring | |
======================================================== | |
Approx. integration time: **2 minutes** | |
WSGI middleware is the most common way to use App Enlight with your web application written in TurboGears2 web framework. | |
Installation and Setup | |
---------------------- |
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
class ReverseProxied(object): | |
''' | |
location /myprefix { | |
proxy_pass http://192.168.0.1:5001; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Scheme $scheme; | |
proxy_set_header X-Script-Name /myprefix; | |
} | |
''' |
NewerOlder