master
Nick Sergeant 2012-04-23 21:41:16 -04:00
parent d2f412b742
commit b76ddb9352
11 changed files with 11 additions and 84 deletions

View File

@ -200,9 +200,6 @@ LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
ACCOUNT_ACTIVATION_DAYS = 0
# HTTPS
USE_HTTPS = False
# User absolute URLs
ABSOLUTE_URL_OVERRIDES = {
'auth.user': lambda u: "/%s/" % u.username,

View File

@ -101,16 +101,11 @@ class Snipt(models.Model):
if settings.DEBUG:
root = 'http://snipt.localhost'
else:
if settings.USE_HTTPS:
root = 'https://snipt.net'
else:
root = 'http://snipt.net'
root = 'https://snipt.net'
return '{}/{}/{}/'.format(root, self.user.username, self.slug)
def get_embed_url(self):
return 'http{}://{}/embed/{}/'.format('s' if settings.USE_HTTPS else '',
site.domain,
self.key)
return 'https://{}/embed/{}/'.format(site.domain, self.key)
@property
def sorted_tags(self):

View File

@ -1 +1 @@
document.open();document.writeln('<div onmouseover="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">');{% for line in lines %}document.writeln('{{ line|safe }}');{% endfor %}document.writeln('<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-{{ snipt.id }}">code hosted by <a href="http://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div>');document.writeln('</div>');document.close();
document.open();document.writeln('<div onmouseover="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">');{% for line in lines %}document.writeln('{{ line|safe }}');{% endfor %}document.writeln('<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-{{ snipt.id }}">code hosted by <a href="https://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div>');document.writeln('</div>');document.close();

View File

@ -14,7 +14,7 @@
{% block tags %}
<div class="profile group">
<span class="avatar" style="background-image: url('http://www.gravatar.com/avatar/{{ user.email|md5 }}?s=50');"></span>
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ user.email|md5 }}?s=50');"></span>
<div class="meta">
<div class="username" title="{{ user.username }}">
{{ user.username }}

View File

@ -58,7 +58,7 @@
<footer>
<ul class="attrs">
<li class="author">
<span style="background-image: url('http://www.gravatar.com/avatar/<%= snipt.user.email_md5 %>?s=15&d=http%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<span style="background-image: url('https://secure.gravatar.com/avatar/<%= snipt.user.email_md5 %>?s=15&d=http%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<a href="<%= snipt.user.absolute_url %>"><%= snipt.user.username %></a>
</li>
<% if (!snipt.new_from_js) { %>

View File

@ -74,7 +74,7 @@
<footer>
<ul class="attrs">
<li class="author">
<span style="background-image: url('http://www.gravatar.com/avatar/{{ snipt.user.email|md5 }}?s=15&d=http%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<span style="background-image: url('https://secure.gravatar.com/avatar/{{ snipt.user.email|md5 }}?s=15&d=http%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<a href="{{ snipt.user.get_absolute_url }}">{{ snipt.user.username }}</a>
</li>
<li class="created" title="{{ snipt.created|date:"Y-m-d\TH:i:s" }}">{{ snipt.created|naturalday }}</li>

View File

@ -1,64 +0,0 @@
{% extends "base.html" %}
{% block page-title %}API Contest - {{ block.super }}{% endblock %}
{% block body-class %}{{ block.super }} api static api-contest{% endblock %}
{% block sub-header %}{% endblock %}
{% block inline-js %}{% endblock %}
{% block content %}
<div class="static-box">
<a href="http://aneventapart.com" class="aea" title="An Event Apart">
<img src="{{ STATIC_URL }}images/an-event-apart.gif" alt="An Event Apart" />
</a>
<h3>Snipt API Contest</h3>
<p>Build an app that uses the new Snipt API and be entered to win two conference passes to <a href="http://aneventapart.com">An Event Apart</a> of your choosing (excluding sold-out shows, and Austin). Public voting determines the winner.
<h4>Rules</h4>
<ul>
<li>App must be complete by <strong>Sunday, April 1st, 2012 at 11pm EST</strong>.</li>
<li>The app must use some part of the public or private Snipt APIs.</li>
<li>App can be for desktop, mobile, CLI, etc. Anything goes.</li>
</ul>
<h4>API</h4>
<p>The API is finished on our end, but we need to get the site up on Snipt.net first so you can use real endpoint URLs, API keys, etc. The authentication mechanism is API-key (no OAuth). Data formats available are JSON, JSONP, XML, YAML.</p>
<p>We will be launching the new Snipt sometime before March 1st, 2012. This will give you at least one full month to build the app.</p>
<p>The private APIs, once launched, will give you complete read/write access to a user's snipts.</p>
<p>Some sample public endpoints:</p>
<ul>
<li><a href="http://beta.snipt.net/api/public/?format=json">http://beta.snipt.net/api/public/?format=json</a></li>
<li><a href="http://beta.snipt.net/api/public/snipt/?format=json">http://beta.snipt.net/api/public/snipt/?format=json</a></li>
<li><a href="http://beta.snipt.net/api/public/snipt/30532/?format=json">http://beta.snipt.net/api/public/snipt/30532/?format=json</a></li>
<li><a href="http://beta.snipt.net/api/public/tag/?format=json">http://beta.snipt.net/api/public/tag/?format=json</a></li>
<li><a href="http://beta.snipt.net/api/public/snipt/?tag=20&amp;format=json">http://beta.snipt.net/api/public/snipt/?tag=20&amp;format=json</a></li>
<li><a href="http://beta.snipt.net/api/public/user/3/?format=json">http://beta.snipt.net/api/public/user/3/?format=json</a></li>
</ul>
<h4>Teams</h4>
<ul>
<li>Feel free to partner up on this project, if you'd like. There are no restrictions on the number of team members participating, but there are only two tickets for prizes (see below).</li>
<li>One entry = one application (regardless of the number of team members)</li>
</ul>
<h4>Prize</h4>
<ul>
<li>Once your app is complete and submitted, it will appear in our app showcase. From there, anyone can vote for your app to win after <strong>Monday April 2nd at 11am EST</strong>, . The app with the most votes by <strong>Monday, April 9th at 11am EST</strong> will be the winner (one full week of voting).</li>
<li>The winner will receive two tickets to <a href="http://aneventapart.com">An Event Apart</a> of your choosing (excluding sold-out shows, and Austin). Each ticket includes access to the 2-day conference but *not* the workshop.</li>
</ul>
<h4>Questions?</h4>
<p>Leave a comment below and we'll respond on this page. Also, follow <a href="http://twitter.com/snipt">@Snipt</a> on Twitter.</p>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'snipt-net';
{% if debug %}
var disqus_developer = 1;
{% endif %}
var disqus_url = 'http://snipt.net{{ request.path }}';
var disqus_title = 'Snipt API Contest';
var disqus_identifier = 9948337532;
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
{% endblock %}

View File

@ -60,7 +60,7 @@
<![endif]-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
@ -278,7 +278,7 @@
},
custom_data: {
'snipts count': {% snipts_count_for_user %},
'profile link': 'http://snipt.net/{{ request.user.username }}/'
'profile link': 'https://snipt.net/{{ request.user.username }}/'
}
};
</script>

View File

@ -2,7 +2,7 @@
<rss version="2.0">
<channel>
<title>/ {% if public and not public_user %}public{% else %}{{ user.username }}{% endif %}{% if tag %} / {{ tag }}{% endif %} - Snipt</title>
<link>http://snipt.net{{ request.path }}</link>{% for snipt in snipts %}
<link>https://snipt.net{{ request.path }}</link>{% for snipt in snipts %}
<item>
<title>{{ snipt.title }}</title>
<link>{{ snipt.get_absolute_url }}</link>

View File

@ -73,7 +73,7 @@
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
@ -86,7 +86,7 @@
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>

View File

@ -33,7 +33,6 @@ urlpatterns = patterns('',
url(r'^500/$', direct_to_template, {'template': '500.html'}),
url(r'^api/$', direct_to_template, {'template': 'api.html'}),
url(r'^api/contest/$', direct_to_template, {'template': 'api-contest.html'}),
url(r'^api/', include(public_api.urls)),
url(r'^api/', include(private_api.urls)),