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 TasksController < ApplicationController | |
# GET /tasks | |
# GET /tasks.xml | |
def index | |
@tasks = Task.all | |
respond_to do |format| | |
tasks = @tasks.map {|task| json_for_task(task) } | |
format.json { render :json => { :content => tasks } } | |
format.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
from collections import defaultdict | |
import freeswitch | |
sound_path_prefix = "/usr/local/freeswitch/sounds/custom/" | |
def text_to_digit(text, len): | |
"""Map text to digits""" | |
atoi_d = { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<img alt="" src="data:image/gif;base64,R0lGODlhMQAwAPcAAAAAAAcHABUVACEhADQ0AEREREZGAElJAElJSUpKLUxMME5OOE9PM1NTN1RUAFRUVFhYAFhYPFlZIVlZWV1dQF9fCmFhAGNjY2RkD2lpAGlpTGpqFWpqamtrM3FxHHNzAHNzc3R0O3d3Inh4I3p6AH19KH19fX5+Pn9/P4CAaoKCgoODAIODLoyMAIyMN4yMjJGRPJWVAJWVJJWVlZmZAJmZKJ6enqGhTKSkAKWlpaamNKysAKysH6+vr7a2ALa2tre3Kry8ALy8Lr29vcTEGsXFxcbGAMfHOc/PAM/PJc/Pz9DQQ9TUKtbW1tnZAN3dFt3dM9/fAN/f3+PjOebmAObmIubm5u3tJu/vAO/v7/b2E/b2MPb29vj4APz8Gf7+AP7+/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
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
# An example of using SQLAlchemy / PSQL for PubSub with asyncio | |
# Rather than using `select.select` to watch for messages, we use | |
# `loop.add_reader`. | |
# Inspired by: https://gist.github.com/dtheodor/3862093af36a1aeb8104 | |
# | |
# One example of use is with aiopyramid. | |
# | |
# For an additional consideration, read about case folding here: | |
# http://stackoverflow.com/a/5173993/465164 |
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
# Constructed with help from | |
# http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses | |
# Try it on regex101: https://regex101.com/r/yVdrJQ/1 | |
import re | |
IPV4SEG = r'(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])' | |
IPV4ADDR = r'(?:(?:' + IPV4SEG + r'\.){3,3}' + IPV4SEG + r')' | |
IPV6SEG = r'(?:(?:[0-9a-fA-F]){1,4})' | |
IPV6GROUPS = ( |
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
import asyncio | |
from asphalt.core import Context | |
import functools | |
def guard_executor(func): | |
no_ctx_msg = ('Context must be the first arg, or an instance variable of ' | |
'`self` (if wrapping an instance method).') | |
not_in_executor_msg = '{} must be run in an executor'.format(func.__name__) |
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 setuptools import setup, find_packages | |
setup( | |
name='server', | |
version='0.1', | |
packages=find_packages(), | |
include_package_data=True, | |
install_requires=[ | |
'aiohttp', | |
# 'aiohttp-graphql', |
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 debian:stable | |
ARG PYTHON_VERSION=3.6.2 | |
### Setup python:{version} ### | |
# helpful links: | |
# https://github.com/pyenv/pyenv/wiki/Common-build-problems | |
# https://github.com/pyenv/pyenv/blob/32922007863c4a54feca2a95226c8307cfdfea3d/plugins/python-build/README.md | |
# https://github.com/pyenv/pyenv/issues/990 | |
RUN apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
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 collections import OrderedDict | |
import graphene | |
import rx | |
subject = rx.subjects.Subject() | |
class Author(graphene.ObjectType): |
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
import asyncio | |
from inspect import iscoroutinefunction | |
import pytest | |
import rx | |
# pylint: disable=W0621, redefined-outer-name | |
def debug(value): |
OlderNewer