Skip to content

Instantly share code, notes, and snippets.

View jokull's full-sized avatar
☺️

Jökull Sólberg Auðunsson jokull

☺️
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jokull on github.
  • I am jokull (https://keybase.io/jokull) on keybase.
  • I have a public key whose fingerprint is 433B F05A 668A 1878 2A74 FAC7 32EE 39EB 0247 7299

To claim this, I am signing this object:

SELECT (gatekeeper_moderatedobject.moderation_status) AS "_moderation_status",
(gatekeeper_moderatedobject.flagged) AS "_flagged",
(gatekeeper_moderatedobject.id) AS "_moderation_id",
"projects_project"."id",
"projects_project"."created",
"projects_project"."modified",
"projects_project"."title",
"projects_project"."mission_statement",
"projects_project"."extra_description",
"projects_project"."picture_id",
from django.conf import settings
from django.db.models import F, Q, Model, IntegerField, BooleanField
from django.db.models.query import QuerySet
from django.core.cache import cache
from django.utils.hashcompat import sha_constructor
from peopleproject.utils.models import BaseModel
class ModerateModel(BaseModel):
"""
# encoding=utf-8
"""
Author: Jökull Sólberg Auðunsson (solberg.is)
"""
from django.core.files.storage import get_storage_class
from django.db.models import ImageField
from uuid import uuid4
/*!
* jQuery.dropload v0.1
*
* Copyright 2010, Jökull Sólberg Auðunsson
* FreeBSD License
* Description:
* For each drop of one or more files the client asynchronously
* sends the files to the server. The request is a multipart
* formencoded binary stream, making it easy to process on the
* server. Works in Chrome 7, maybe Safari.
@jokull
jokull / facebook_status.py
Created February 11, 2011 13:08
Fetch and cache Facebook status from feed
import datetime
import feedparser
import bleach
from flask import g, Markup
from kex.app import app
class Status(object):
ALLOWED_TAGS = []
from flaskext.fungiform import Form, widgets, TextField, FileField
class Admin(object):
module = Module(__name__, name='_admin', url_prefix='/_admin')
def __init__(self, app=None, editables=[]):
for editable in editables:
self.register_editable(editable)
@jokull
jokull / jquery.fungiform.js
Created April 28, 2011 11:34
Appends an `add` button to all `.multiple-items` rendered by fungiform for adding `Multiple` or `MultiChoiceField` in the DOM
(function(){
var resetLi = function($li, index){
$li.find(":input, label").each(function(i){
var $that = $(this);
$.each(['name', 'id', 'for'], function(i, attribute){
var value = $that.attr(attribute);
if(value){
$that.attr(attribute, value.replace(/\d+/, index))
}
});
@jokull
jokull / index.html
Created September 7, 2011 11:40
Public Instagram hashtag using Backbone.js and CoffeeScript
<html>
<head>
<script type="text/template" id="tpl-instagram-post">
<a href="<%= link %>"><img src="<%= images.low_resolution.url %>"></a>
<p class="date"><%= created_time %></p>
<p class="user">@<%= user.username %></p>
<% if(caption){ %>
<p class="caption"><%= caption.text %></p>
<% } %>
</script>
@jokull
jokull / tumblr.py
Created December 10, 2011 16:55
Tumblr CachedResponse for restkit
# encoding=utf-8
"""
Use Tumblr as a backend for a blog. This module
helps interfacing with their APIv2 in a pythonic way. Caching
keeps things responsive and guards against API downtime and
response failures.
Assumptions: