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 BeautifulSoup import BeautifulSoup | |
from mechanize import Browser | |
def CometScrape(date): | |
br = Browser() | |
entry = None | |
br.open('http://www.comettavern.com/shows.php') | |
br.select_form(nr=0) | |
form = br.form | |
month = ['January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][int(date[0:2]) - 1] |
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
def earliestTime(x): | |
conv = {} | |
for t in x: | |
a, b = t[:t.find('m')-1].split(':') if ':' in t else (t[:t.find('m')-1], 0) | |
conv[(int(a) * 60) + int(b) - (720 if 'am' in t else 0)] = t | |
return conv[min(conv.keys())].strip() |
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 re | |
class finder(): | |
# I got these dicts from someone on Stackoverflow. They translate common letters to visually similar unicode keys. | |
# This will let us match an N with a tilde to a regular N, for example | |
global unicode_to_text_Matches | |
unicode_to_text_Matches = { 161: '!', 192: 'A', 193: 'A', 194: 'A', 195: 'A', 196: 'A', 197: 'A', 198: 'Ae', 199: 'C', 200: 'E', 201: 'E', 202: 'E', 203: 'E', 204: 'I', 205: 'I', | |
206: 'I', 207: 'I', 208: 'Th', 209: 'N', 210: 'O', 211: 'O', 212: 'O', 213: 'O', 214: 'O', 216: 'O', 217: 'U', 218: 'U', 219: 'U', 220: 'U', 221: 'Y', 222: 'th', 223: 'ss', 224: 'a', | |
225: 'a', 226: 'a', 227: 'a', 228: 'a', 229: 'a', 230: 'ae', 231: 'c', 232: 'e', 233: 'e', 234: 'e', 235: 'e', 236: 'i', 237: 'i', 238: 'i', 239: 'i', 240: 'th', 241: 'n', 242: 'o', |
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
// bandscape vmarker library written by Artur Sapek | |
// puts a venue's custom marker on the map and makes it interact with the Hub | |
vmarker = function(args){ | |
for (var a in args){ | |
this[a] = args[a]; | |
} | |
this.draw(this.x, this.y, this.name); | |
} | |
vmarker.prototype.draw = function(x, y, 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
<script type="text/javascript"> | |
csrfTOKEN = '{{ csrf_token }}'; | |
profileID = '{{ user.profile.id }}'; | |
function setDownToJam(bool){ | |
$.ajax({ | |
type: 'POST', | |
url: '/jam/down-to-jam-ajax/', | |
data: {'csrfmiddlewaretoken': csrfTOKEN, |
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
// DOM objects used in bandscape main view | |
// author: Artur Sapek | |
// bandscape 2011 | |
// pre: nothing | |
// post: returns top-right control on the map, date and city (city doesn't do anything) and injects into DOM | |
function dateControl(){ | |
var me = this; | |
this.dropdownFairGame = true; | |
this.keepopen = false; |
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
/* | |
bandscape CSS | |
author: Artur Sapek | |
*/ | |
html, body{ | |
height:100%; | |
margin:0px; | |
overflow:hidden; | |
background:#F5F5F6; |
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
for i in range(0, 101): | |
d = {} | |
d[i % 3], d[i % 5] = 'Fizz', 'Buzz' | |
if 0 in d: | |
if len(d) == 1: | |
print 'FizzBuzz' | |
else: | |
print d[0] | |
else: | |
print i |
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 random | |
image = open('e.jpg', 'r') | |
lines = ''.join(image.readlines()) | |
image.close() | |
ran = int(random.random() * len(lines)) | |
for i in range(0, int(str(ran)[:1])/2): | |
ran = int(random.random() * len(lines)) | |
t = lines[ran:ran+ran*6] |
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
cm.destroy(key) | |
.on('complete', function(){ | |
$('span[item="' + key + '"]').remove(); | |
}) |
OlderNewer