Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

from collections import defaultdict
people = [{'name':'Tony', 'city':'Portland', 'age':'43'}, \
{'name':'Joe', 'city':'Palo Alto', 'age':'35'}, \
{'name':'Srujan', 'city':'Palo Alto', 'age':'25'}, \
{'name':'Krishna', 'city':'Palo Alto', 'age':'25'}, \
{'name':'Miles', 'city':'Palo Alto', 'age':'35'}, \
{'name':'Ross', 'city':'Portland', 'age':'45'}]
tmayse / polling_main.py
Created January 21, 2014 23:31
Polling main loop
while True: #keep polling for new responses until terminated (eg. ctl-c)
# get time 5 seconds ago for use as the "end_modified_date"
# in string format for API - this will ensure SurveyMonkey
# is done processing all responses between start & end dates
five_seconds_ago = (datetime.fromtimestamp(mktime(gmtime())) -
timedelta(seconds = 5)).strftime('%Y-%m-%d %H:%M:%S')
respondent_post_data["start_modified_date"] = last_date_checked
respondent_post_data["end_modified_date"] = five_seconds_ago
# get responses modified at or later than start_modified_date and
# responses EARLIER than (but not at) end_modified_date
tmayse / polling_init.py
Last active January 4, 2016 01:49
Polling initialize
# initialize objects used later on
pp = pprint.PrettyPrinter(indent=4)
limiter = rate_wait(2)
SURVEY_ID = "12345678" #use get_survey_list to find the ID
HOST = "https://api.surveymonkey.net"
# add paths to HOST to create the two API endpoint URIs
respondent_uri = "%s/v2/surveys/get_respondent_list" % HOST
response_uri = "%s/v2/surveys/get_responses" % HOST
tmayse / polling_setup.py
Created January 21, 2014 23:26
Polling Setup
import requests
import json
import pprint
import __future__
from time import gmtime, mktime, sleep, time
from datetime import timedelta, datetime
class rate_wait:
"""Non-threadsafe way to wait until the next time a
rate-limited function should be called.

Inquiry # 1 I am wanting to use the survey monkey api to retrieve a list of the surveys associated with an account. With the survey details I would like to get the survey web link (which is used for respondents to click on to go and fill out the survey). Is this possible with the current api?

Your Response: (If possible please give code snippets in Python to help answer the question)

Hi there,

That's a great question. You can certainly retrieve the web link for a survey using Survey Monkey's API.

We start with Bostock's Multi-Foci Force Layout example and add motion to represent traffic progressing through a system. Think of this as progress bars for every inflight transaction.

Each dot represents a transaction read from a four-minute long recording. Watch for a spike in activity at 12:20:20. The animation repeats when finished.

Dots enter when transactions start and exit when completed. Their speed is proportional to client's response time while their size reflects the server's contribution to total time. Color comes from the specific request.

tmayse / README.md
Last active December 19, 2015 15:59 — forked from mbostock/.block

This variation of a simple bar chart adds sorting with staggered delay and translucency to improve readability during the transition. This technique is recommended by Heer & Robertson. Use the checkbox in the top right to turn sorting on or off.

This stacked bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

Switch between stacked and grouped layouts using sequenced transitions! Animations preserve object constancy and allow the user to follow the data across views. Animation design by Heer and Robertson. Colors and data generation inspired by Byron and Wattenberg.

This stacked area chart is constructed from a TSV file storing the market share of several popular web browsers over the last year. Data is from Clicky Web Analytics. The chart employs conventional margins and a number of D3 features:

AltStyle によって変換されたページ (->オリジナル) /