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
# Source: http://stackoverflow.com/questions/2454149/python-detect-destination-of-shortened-or-tiny-url | |
import urllib2 | |
response = urllib2.urlopen("http://bit.ly/AoifeMcL_ID3") # Some shortened url | |
url_destination = response.url |
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 datetime import datetime | |
def import_bookmarks(data): | |
''' | |
Get bookmarks from Delicious' export file format | |
''' | |
soup = BeautifulSoup(data) | |
deli_bookmarks = soup.findAll('dt') |
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
p.follow-us { | |
display: none !important; | |
} | |
p.hosted a { | |
display: none !important; | |
} | |
div.box { | |
box-shadow: none !important; |
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
//this is a generic function which should be moved to a Baseclass of Backbone or a Backbone extension | |
autoBind = | |
{ | |
autoBind: function () { | |
var self = this; | |
var funcs = _.functions(this.constructor.prototype); | |
var protoFuncs = ['autoBind', 'constructor'].concat( | |
_.functions(Backbone.Collection.prototype), | |
_.functions(Backbone.Model.prototype), | |
_.functions(Backbone.View.prototype)); |
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
>>> 'NICK = jori' | |
>>> 'USER jorilallo jorilallo localhost :Jori Lallo' | |
<<< ':localhost 375 = :Welcome to new IRC! -- leah ()' | |
<<< ':localhost 376 = :End of /MOTD command.' | |
<<< ':localhost 001 = :Welcome to localhost' | |
<<< ':localhost 002 = :Your host is localhost, running version 0.0.1' | |
<<< ':localhost 003 = :This server was created 2011-07-10 06:43:35.799950' | |
<<< ':localhost 004 = localhost :0.0.1 w n' | |
>>> 'MODE = +i' | |
<<< ':localhost 472 = :Unknown MODE flag.' |
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
/* See http://cl.ly/8KmQ for an example */ | |
hr { | |
margin: 15px 0; | |
position: relative; | |
border: 1px solid transparent; | |
.box-shadow(0, 1px, 2px, rgba(0,0,0,0.3)); | |
&:before, &:after { | |
content: ""; |
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
Not synced (use migrations): | |
- channels | |
- accounts | |
- orgs | |
(use ./manage.py migrate to migrate these) | |
Running migrations for channels: | |
- Migrating forwards to 0001_initial. | |
> channels:0001_initial | |
Traceback (most recent call last): |
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
setInterval(function(){ | |
$('.content a').each(function() { | |
if (/\.(gif|jpe?g|png)/i.test($(this).text())) | |
$(this).html('<img src="'+$(this).text()+'"/>') | |
}) | |
}, 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
class EnvironmentResource(ModelResource): | |
class Meta: | |
queryset = Environment.objects.all() | |
resource_name = 'environment' | |
list_allowed_methods = ['get', 'post'] | |
authentication = ApiKeyAuthentication() | |
authorization = Authorization() | |
def obj_create(self, bundle, request=None, **kwargs): | |
return super(EnvironmentResource, self).obj_create(bundle, request, user=request.user) |
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
r = ListResource() | |
lists = r.obj_get_list(request) | |
lists_json = [] | |
for list in lists: | |
bundle = r.build_bundle(obj=list, request=request) | |
lists_json.append(r.serialize(None, r.full_dehydrate(bundle), 'application/json')) |
OlderNewer