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
if request.method == 'GET': | |
id = request.GET['id'] | |
tagging = Images.objects.get(id=id) | |
tags = Tag.objects.usage_for_model(tagging, counts=True) | |
usageNum = [{"tag": tagfreq.name, "count": tagfreq.count} for tagfreq in tags] | |
dump = simplejson.dumps(usageNum) | |
message = dump | |
$("#tagcloud").tagCloud(tags); |
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 cat_tag(request): | |
if request.is_ajax(): | |
if request.method == 'GET': | |
id = request.GET['id'] | |
tagging = Images.objects.get(id=id) | |
tags = Tag.objects.usage_for_model(tagging, counts=True) | |
usageNum = [{"tag": tagfreq.name, "count": tagfreq.count} for tagfreq in tags] | |
dump = simplejson.dumps(usageNum) | |
message = dump | |
elif request.method == 'POST': |
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 urllib, urllib2, cookielib | |
import mechanize | |
import lxml.html as poop | |
import os, ConfigParser | |
def preDBLookup(cat): | |
br = mechanize.Browser() | |
br.set_handle_robots(False) | |
try: | |
r = br.open("http://orlydb.com/?q=%s" % (cat)) |
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
#same response | |
#http://www.goodreads.com/book/isbn?isbn=0441172717&key=1NzniiGBie03MWduCDH8g | |
# | |
#code currently returns index out of range | |
from mobi import Mobi | |
from HTMLParser import HTMLParser | |
import textwrap | |
import urllib, urllib2, cookielib | |
from lxml import etree |
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 show_tag(request, tag): | |
genre = Book.objects.filter(book_genres__name__in=[tag]) | |
genres = [] | |
for x in genre: | |
genres.append(x) | |
return render(request, 'viewer/genreview.html', | |
{ | |
'genre': genres, | |
}, | |
context_instance=RequestContext(request)) |
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 tweepy | |
from util import hook, http | |
import simplejson | |
consumer_key = "" | |
consumer_secret = "" | |
key = "" | |
secret = "" |
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
private static void EncryptFile(string inputFile, string outputFile) | |
{ | |
int num; | |
string s = "h3y_gUyZ"; | |
byte[] bytes = new UnicodeEncoding().GetBytes(s); | |
string path = outputFile; | |
FileStream stream = new FileStream(path, FileMode.Create); | |
RijndaelManaged managed = new RijndaelManaged(); | |
CryptoStream stream2 = new CryptoStream(stream, managed.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write); | |
FileStream stream3 = new FileStream(inputFile, FileMode.Open); |
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
a = 2 | |
i = 1 | |
w = 0 | |
def numcheck(a) | |
for i in 1..7 | |
puts i | |
if a%i==0 | |
w +=1 | |
break if w == 7 |
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 apply_sorting(self, obj_list, options=None): | |
""" override apply_sorting to enable random sorting """ | |
try: | |
return super(CatResource, self).apply_sorting(obj_list, options) | |
except InvalidSortError: | |
parameter_name = 'order_by' | |
if hasattr(options, 'getlist'): | |
order_bits = options.getlist(parameter_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
bro |
OlderNewer