This file contains hidden or 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
| function getPeople(callback) { | |
| $.get("people", callback); | |
| } | |
| function getPerson(id, callback) { | |
| $.get("person/{id}", callback); | |
| } | |
| function storePerson(data, callback) { | |
| db.call("INSERT INTO PEOPLE VALUES {data}", callback); |
This file contains hidden or 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 experimenter.experiments.models import Experiment | |
| statuses = [s for s, _ in Experiment.STATUS_CHOICES] | |
| status_pairs = list(zip([None] + statuses, statuses)) | |
| for experiment in Experiment.objects.all(): | |
| experiment_dates = [] | |
| for old_s, new_s in status_pairs: | |
| experiment_dates.append(str(experiment._transition_date(old_s, new_s))) | |
| print(','.join([str(experiment), experiment.experiment_url, *experiment_dates])) |
This file contains hidden or 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
| 44 user_pref("browser.newtabpage.activity-stream.feeds.section.topstories.rec.impressions", "{\"35957\":1553620175627,\"35972\":1553620175627,\"35980\":1553628872028,\"35985\":1553635272422,\"35987\ ":1553642434054,\"35989\":1553645106152,\"36009\":1553703116751,\"36011\":1553710795315,\"36013\":1553710795315,\"36017\":1553703116751,\"36022\":1553703116751,\"36026\":1553704659566,\"36028\":1 553709968726,\"36030\":1553711923495}"); |
This file contains hidden or 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
| jkerim@jkerim-mbp~/Documents/rust-todo/api(master)$ docker run -it todo sh | |
| # cargo build | |
| Finished dev [unoptimized + debuginfo] target(s) in 0.18s | |
| # cargo run | |
| Finished dev [unoptimized + debuginfo] target(s) in 0.20s | |
| Running `target/debug/rust-todo` | |
| Hello, world! | |
| # cargo clean -p rust-todo | |
| # cargo build | |
| Compiling rust-todo v0.1.0 (/app) |
This file contains hidden or 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
| jkerim@jkerim-mbp~/Documents/rust-todo/api(master)$ docker run -it todo sh | |
| # cat src/main.rs | |
| extern crate actix_web; | |
| extern crate listenfd; | |
| use listenfd::ListenFd; | |
| use actix_web::{server, App, HttpRequest, Responder}; | |
| fn index(_req: &HttpRequest) -> impl Responder { | |
| "Fast start" |
This file contains hidden or 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 AuthenticationDelegator(object): | |
| def __init__(self, auth_middlewares): | |
| self.auth_middlewares = auth_middlewares | |
| def process_request(self, request): | |
| for middlware in self.auth_middlewares: | |
| try: | |
| return middleware.process_request(request): |
This file contains hidden or 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
| response_data = make_bugzilla_call(settings.BUGZILLA_CREATE_URL, bug_data) | |
| if response_data is not None: | |
| if response_data.get("code", None) == INVALID_USER_ERROR_CODE: | |
| del bug_data["assigned_to"] | |
| response_data = make_bugzilla_call(settings.BUGZILLA_CREATE_URL, bug_data) | |
| return response_data.get("id", None) |
This file contains hidden or 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
| 69 response_data = make_bugzilla_call(settings.BUGZILLA_CREATE_URL, bug_data) | |
| 70 | |
| 71 if response_data is not None: | |
| 72 if response_data.get("code", None) == INVALID_USER_ERROR_CODE: | |
| 73 del bug_data["assigned_to"] | |
| 74 | |
| 75 response_data = make_bugzilla_call(settings.BUGZILLA_CREATE_URL, bug_data) | |
| 76 | |
| 77 return response_data.get("id", None) |
This file contains hidden or 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
| import random | |
| from experimenter.experiments.models import Experiment | |
| from experimenter.experiments.tests.factories import ExperimentFactory | |
| for i in range(100): | |
| ExperimentFactory.create_with_status(random.choice(Experiment.STATUS_CHOICES)[0]) |
This file contains hidden or 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
| In [94]: ExperimentEnrollment.objects.all().annotate(hour=Trunc('window_start', 'hour')).values('experiment', 'branch', 'hour').annotate(hour_enroll_sum=Sum('enroll_count'), hour_unenroll_sum=Sum('unenroll_count') | |
| ...: )[0] | |
| {"Timestamp": 1533064257797387776, "Type": "django.db.backends", "Logger": "experimenter", "Hostname": "d8047f90780f", "EnvVersion": "2.0", "Severity": 7, "Pid": 507, "Fields": {"duration": 0.0010690689086914062, "sql": "SELECT \"experiments_experimentenrollment\".\"experiment\", \"experiments_experimentenrollment\".\"branch\", DATE_TRUNC('hour', \"experiments_experimentenrollment\".\"window_start\" AT TIME ZONE 'UTC') AS \"hour\", SUM(\"experiments_experimentenrollment\".\"enroll_count\") AS \"hour_enroll_sum\", SUM(\"experiments_experimentenrollment\".\"unenroll_count\") AS \"hour_unenroll_sum\" FROM \"experiments_experimentenrollment\" GROUP BY \"experiments_experimentenrollment\".\"experiment\", \"experiments_experimentenrollment\".\"branch\", DATE_TRUNC('hour', \"experiments_exper |
NewerOlder