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
# word frequency in a text | |
# tested with Python24 vegaseat 25aug2005 | |
# Chinese wisdom ... | |
str1 = """Man who run in front of car, get tired. | |
Man who run behind car, get exhausted.""" | |
print "Original string:" | |
print str1 | |
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
$(document).ready(function(){ | |
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", | |
function(data){ | |
$.each(data.items, function(i,item){ | |
$("<img/>").attr("src", item.media.m).appendTo("#images"); | |
if ( i == 3 ) return 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
http://search.twitter.com/search.json?q=%40human_bot | |
{ | |
"results": [{ | |
"text": "@human_bot Are you feeling okay? Sounds like you've been smoking some crack with the way you've been talking lately.", | |
"to_user_id": 5740619, | |
"to_user": "human_bot", | |
"from_user": "taboularasa", | |
"id": 1306533155, |
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
> results = [] | |
> for app in apps: | |
> results.append({"appname" : app.appname}) | |
just a small tip.. you can write this as | |
results = [ {"appname": app.appname} for app in apps ] |
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
class SendTweet(webapp.RequestHandler): | |
def post(self): | |
self.response.headers['Content-Type'] = 'text/plain' | |
tweet = cgi.escape(self.request.get('content')) + "duhhh" | |
username = "username" | |
login = username | |
password = "password" | |
payload= {'status' : tweet, 'source' : "GAE script"} | |
payload= urllib.urlencode(payload) | |
base64string = base64.encodestring('%s:%s' % (login, password))[:-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
>>> import re | |
>>> myString = "apple+ monkey+ bird+ cat+" | |
>>> myString = re.sub("\s+", "", myString) | |
>>> myString = myString.rstrip('+') | |
>>> print myString | |
apple+monkey+bird+cat |
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” src=”jquery-latest.pack.js”></script> | |
<script type=”text/javascript” src=”jquery.highlightFade.js”></script> | |
function addFormField() { | |
var id = document.getElementById(”id”).value; | |
$(”#divTxt”).append(”<p id=’row” + id + “‘><label for=’txt” + id + “‘>Field ” + id + ” <input type=’text’ size=’20′ name=’txt[]‘ id=’txt” + id + “‘> <a href=’#’ onClick=’removeFormField(\”#row” + id + “\”); return false;’>Remove</a><p>”); | |
$(’#row’ + id).highlightFade({ | |
speed:1000 | |
}); |
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
mylist = list(set(mylist)) |
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 com.sun.image.codec.jpeg.*; | |
PImage img; | |
int numberOfFrames = 600; | |
void setup() | |
{ | |
size(1024,768); | |
} | |
OlderNewer