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 bs4 import BeautifulSoup | |
import requests | |
import re | |
import json | |
base_url = 'http://na.leagueoflegends.com/' | |
get_page = lambda x: BeautifulSoup(requests.get(base_url + x).text) | |
# step one, get a list of all champion urls |
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
{% for field in form %} | |
<div class="control-group {% if field.errors %}error{% endif %}"> | |
<label class="control-label" for="{{ field.html_name }}">{{ field.label }}</label> | |
<div class="controls"> | |
{{ field }} | |
{% if field.errors %} | |
<span class="help-inline">{{ field.errors|first }}</span> | |
{% endif %} | |
{% if field.help_text %} | |
<p class="help-block">{{ field.help_text }}</p> |
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
$.ajaxSetup( | |
{ | |
beforeSend: (xhr, settings) -> | |
getCookie = (name) -> | |
cookieValue = null | |
if (document.cookie and document.cookie) isnt '' | |
cookies = document.cookie.split(';') | |
for cookie in cookies | |
console.log cookie | |
if cookie.substring(0, name.length+1) is name+'=' |
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
months = [] | |
for month in range(12): | |
weight = -1 | |
while weight < 0: | |
weight = float(raw_input('input weight for month #%d: ' % (month+1))) | |
months.append(weight) | |
average = reduce(lambda x,y:x+y, months) / 12 | |
print 'average weight is %f' % average |
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
class Session(models.Model): | |
course = models.ForeignKey(Course, related_name='sessions') | |
name = models.CharField(max_length=100) | |
content = models.TextField() | |
def pages(self): | |
def add_h1(string): | |
return "# %s" % string | |
return map(add_h1, re.split(r'\n#[^#]', self.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
<html> | |
<head> | |
<title>Progressive Conference | Instagram Feed</title> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript" src="script.js"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<section id="feed"> | |
</section> |
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
PID_FILE="/tmp/gunicorn_photokarma" | |
echo "pulling changes" | |
git pull | |
echo "checking for new pip deps" | |
pip install -r requirements.txt | |
echo "collecting static files" | |
python manage.py collectstatic --noinput |
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 slugify(input): | |
allowed = "abcdefghijklmnopqrstuvwxyz0123456789" | |
output = "" | |
for letter in input.lower(): | |
if letter not in allowed: | |
letter = '-' | |
output = output + letter | |
return output |
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
class FeedManager(models.Manager): | |
def to_json(self): | |
l = [] | |
for feed in self.get_query_set(): | |
l.append(feed.dump()) | |
return dumps(l) | |
class Feed(models.Model): | |
owners = models.ManyToManyField(User, related_name='owned_feeds') |
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
%!PS-Adobe-3.0 | |
%%Creator: groff version 1.19.2 | |
%%CreationDate: Sat Mar 24 03:12:37 2012 | |
%%DocumentNeededResources: font Times-Bold | |
%%+ font Courier-Bold | |
%%+ font Times-Roman | |
%%+ font Courier-Oblique | |
%%+ font Symbol | |
%%+ font Courier | |
%%DocumentSuppliedResources: procset grops 1.19 2 |