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 tropo import Tropo | |
from djtropo import tropo_view | |
@tropo_view | |
def ivrintro(request): | |
"""Say hello world and hangup.""" | |
t = Tropo() | |
t.say('hello, world!') |
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
<html> | |
<head> | |
<title>My Test PHP Page!</title> | |
</head> | |
<body> | |
<?php echo "<p>My first dynamic website!</p>"; ?> | |
</body> | |
</html> |
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
/* | |
* test.c | |
* | |
* This example program demonstrates a weird way to reference array elements in | |
* C. All credit goes to the Stack Overflow 'Strangest language feature' | |
* discussion page: | |
* http://stackoverflow.com/questions/1995113/strangest-language-feature | |
*/ | |
#include <stdio.h> |
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
## | |
# This gist is an update of the tropo python scripting tutorial page. It contains some | |
# suggested changes that would make the tutorial more familiar to native python | |
# developers. | |
# | |
# The tropo python scripting tutorial can be found at: | |
# https://www.tropo.com/docs/scripting/t_tutorial-python.htm | |
# | |
# NOTE: All changes I've proposed here are very simple (just removing parenthesis | |
# from if statements, mostly). All examples work well. The python style guide |
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 sys import exit | |
from lxml import etree | |
response = 'some xml response here' | |
try: | |
doc = etree.XML(response.strip()) | |
code = doc.findtext('code') | |
print code | |
except etree.XMLSyntaxError: |
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 lxml import etree | |
response = 'some xml response here' | |
try: | |
doc = etree.XML(response.strip()) | |
code = doc.findtext('code') | |
print code | |
except etree.XMLSyntaxError: | |
print 'XML parsing error.' |
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
<?xml version="1.0" encoding="utf-8"?> | |
<response version="1.0"> | |
<code>400</code> | |
<errors> | |
<error>This API call requires a HTTP POST.</error> | |
</errors> | |
</response> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<response version="1.0"> | |
<code>200</code> | |
<id>50</id> | |
</response> |
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 myapp.models import Server | |
from myapp.models import ServerForm | |
from django.template import RequestContext | |
from django.shortcuts import render_to_response | |
def create_server(request): | |
""" | |
Create a new Server model. | |
""" |
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 django.db import models | |
from django.forms import ModelForm | |
class Server(models.Model): | |
""" | |
This class represents a physical server. | |
""" | |
hostname = models.CharField('Server Name', | |
help_text = 'Hostname of the server.', | |
max_length = 50 |