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
preload = (urls) -> | |
for url in urls | |
braces = url.match(/{\d\.\.\d}/g) | |
if braces | |
nums = braces[0].match(/\d/g) | |
expanded = [] | |
for num in [nums[0]..nums[1]] | |
expanded.push url.replace(braces[0], num) | |
preload expanded | |
else |
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
// Download a file to your machine | |
download = function(key){ | |
// The CM download API call only requires a key as a parameter. | |
// Here we also include a second options parameter where "filename" tells | |
// the SDK we want to download the file to our local filesystem. | |
cm.download(key, {filename: key}); | |
} |
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
cm.destroy(key) | |
.on('complete', function(){ | |
$('span[item="' + key + '"]').remove(); | |
}) |
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 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 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 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 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
/* | |
bandscape CSS | |
author: Artur Sapek | |
*/ | |
html, body{ | |
height:100%; | |
margin:0px; | |
overflow:hidden; | |
background:#F5F5F6; |
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
// 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 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
<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 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
// 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 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 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', |