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 urllib2 | |
| site = Site.objects.get_current() | |
| absolute_url = 'http://%s%s' % (site.domain, | |
| instance.get_absolute_url()) | |
| asolute_url = urllib2.quote(absolute_url, safe='') | |
| vamu_api = 'http://va.mu/api/create/?url=%s' % (absolute_url) | |
| short_url = urllib2.urlopen(vamu_api).read() |
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
| def latest_post(request, blog_slug): | |
| blog = get_object_or_404(Blog, slug=blog_slug) | |
| try: | |
| latest = blog.posts.latest('pub_date') | |
| except | |
| q = model.objects.all().order_by('-'+date_field) | |
| if kwargs: | |
| q = q.filter(**kwargs) |
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
| /* ABAS DE PROGRAMAÇÃO */ | |
| (function(){ | |
| var tabContainers = $('div.tabs > div > div'); | |
| $('div.tabs ul.tabNavigation a').click(function () { | |
| tabContainers.hide().filter(this.hash).show(); | |
| $('div.tabs ul.tabNavigation a').removeClass('active'); | |
| $(this).addClass('active'); | |
| return false; | |
| }).filter(':first').click(); | |
| })(); |
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
| # -*- coding: utf-8 -*- | |
| import pickle | |
| import pywapi | |
| import string | |
| import pprint | |
| pp = pprint.PrettyPrinter(indent=4) | |
| forecasts = ['BRXX3706', 'BRXX0104', 'BRXX2863', 'BRXX1936', 'BRXX0079', 'BRXX0063', 'BRXX0137', 'BRXX0151', 'BRXX1865'] |
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
| # Yahoo Weather Solution with RSS | |
| # http://developer.yahoo.com/weather/ | |
| # http://weather.yahoo.com/ | |
| import requests | |
| url = "http://weather.yahooapis.com/forecastrss?w=26804118&u=c" | |
| response = requests.get(url) | |
| print response.content | |
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
| <h1>{{ poll.question }}</h1> | |
| {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} | |
| <form action="/polls/{{ poll.id }}/vote/" method="post"> | |
| {% for choice in poll.choice_set.all %} | |
| <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" /> | |
| <label for="choice{{ forloop.counter }}">{{ choice.choice }}</label><br /> | |
| {% endfor %} | |
| <input type="submit" value="Vote" /> |
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.shortcuts import get_object_or_404, render_to_response | |
| from django.http import HttpResponseRedirect | |
| from django.core.urlresolvers import reverse | |
| from agenda_test.polls.models import Choice, Poll | |
| def index(request): | |
| latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] | |
| return render_to_response('poll_list.html', {'latest_poll_list': latest_poll_list}) | |
| def detail(request, poll_id): |
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
| # == Schema Information | |
| # | |
| # Table name: people | |
| # | |
| # id :integer not null, primary key | |
| # user_id :integer | |
| # profile_id :integer | |
| # full_name :string(255) | |
| # birth_date :date | |
| # created_at :datetime |
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"?> | |
| <opml version="1.0"> | |
| <head> | |
| <title>Documentos Subscritos ao iTunes</title> | |
| <dateCreated>Tue, 11 May 2010 00:01:55 GMT</dateCreated> | |
| <dateModified>Tue, 11 May 2010 00:01:55 GMT</dateModified> | |
| </head> | |
| <body> | |
| <outline text="RailsLab : Scaling Rails" type="rss" xmlUrl="http://feeds.feedburner.com/Scaling-Rails" htmlUrl="/category/scaling-rails.rss" /> | |
| <outline text="Ruby on Rails Podcast" type="rss" xmlUrl="http://feeds.feedburner.com/rubyonrailspodcast" htmlUrl="http://podcast.rubyonrails.org" /> |
NewerOlder