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 Image | |
def borders(filename): | |
im = Image.open(filename) | |
im = im.convert("RGB") | |
pix = im.load() | |
x = im.size[0]-1 | |
y = im.size[1]-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 Image | |
def borders(filename): | |
im = Image.open(filename) | |
im = im.convert("RGB") | |
pix = im.load() | |
x = im.size[0]-1 | |
y = im.size[1]-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
if (typeof window.location.hash == "string" && window.location.hash != "") | |
{ | |
$(window.location.hash).addClass('anchored'); | |
} |
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 formfield_for_dbfield(self, db_field, **kwargs): | |
if db_field.name == "user": | |
return forms.ModelChoiceField(queryset=User.objects.all().order_by('username'), initial=kwargs['request'].user.id) | |
return super(NamedAdmin, self).formfield_for_dbfield(db_field, **kwargs) |
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
var querystring = function () { | |
var obj = {}; | |
var query = window.location.search.substring(1); | |
if (query != "") { | |
var vars = query.split("&"); | |
for (var i = 0; i < vars.length; i++) { | |
var p = vars[i].split("="); | |
obj[p[0]] = p[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 borders(filename, threshold = 0.5): | |
try: | |
im = Image.open(filename) | |
im = im.convert("RGB") | |
pix = im.load() | |
x = int(im.size[0]) | |
y = int(im.size[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
javascript:window.location.href='http://www.example.com/postbookmark/?url='+encodeURIComponent(window.location.href)+'&user=riklomas&secret=948340934503498'; |
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
# How to add a field to the Django Admin Add User form | |
# using UserCreationForm. Add this to a admin.py and alter | |
# to whatever fields you'd like | |
from django.contrib.auth.forms import UserCreationForm | |
from django.contrib.auth.models import User | |
from django.contrib.auth.admin import UserAdmin | |
from django import forms | |
from django.utils.translation import ugettext_lazy as _ | |
from django.contrib import admin |
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
<% nmonth = "" %> | |
<li> | |
<ul class="weeks"> | |
<li>Week</li> | |
<% navigation_weeks.each do |w| %> | |
<li class="<%= (controller_name == "posts" || controller_name == "things") && params[:action]=="index" && params[:week].present? && params[:year].present? && params[:week]==w.week.to_s && params[:year]==w.year.to_s ? 'active' : '' %>"> | |
<%= link_to posts_path(:week => w.week, :year => w.year), :class => 'tip', :title => week_dates(w.week, w.year) do %> | |
<%= w.week %> | |
<% if nmonth != week_month(w.week, w.year) %> | |
<span class="<%= week_month(w.week, w.year).downcase %>"><%= week_month(w.week, w.year) %></span> |
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"> | |
(function ($) { | |
$(function () { | |
$('ul.dd li').tipsy({gravity: $.fn.tipsy.autoNS}); | |
}); | |
})(jQuery); | |
</script> |
OlderNewer