Skip to content

Instantly share code, notes, and snippets.

View trepca's full-sized avatar
🔜

Sebastjan Trepca trepca

🔜
  • Slovenia
  • 22:13 (UTC -12:00)
  • X @trepca
View GitHub Profile
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from oauth import oauth
signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1()
OAUTH_CONSUMER_KEY = 'http://www.myspace.com/xxxxxxxx'
OAUTH_SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
def _get_request_signature(url, params):
function makeSignedRequest() {
var params = {'person': 1, 'context':100};
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
var url = "http://www.test.com/resource";
gadgets.io.makeRequest(url,authResponse, params);
}
function authResponse(data) {
for(var i in data) {
test
class Task(models.Model):
title = models.CharField(max_length=128)
owner = models.ForeignKey(User)
due_date = models.DateTimeField(blank=True, null=True)
start_date = models.DateTimeField(blank=True, null=True)
date_created = models.DateTimeField(auto_now_add=True)
notes = models.ManyToManyField('Note', blank=True, null=True)
class Event(models.Model):
title = models.CharField(max_length=128)
class Todo(models.Model):
title = models.CharField(max_length=128)
owner = models.ForeignKey(User)
body = models.TextField(blank=True, null=True)
due_date = models.DateTimeField(blank=True, null=True)
start_date = models.DateTimeField(blank=True, null=True)
date_created = models.DateTimeField(auto_now_add=True)
location = models.CharField(blank=True, null=True)
all_day = models.BooleanField(default=False)
using terms from application "Quicksilver"
on process text task_text
set results to do shell script "emacsclient -n \"org-protocol:/capture:/w/_/_/" & task_text & "\""
end process text
end using terms from
; you also need to enable org-protocol in your org-modules variable
(setq org-modules (quote (org-protocol)))
(setq org-capture-templates (quote (("t" "todo" entry (file "~/org/inbox.org") "* TODO %?
%U
%a" :clock-in t :clock-resume t)
("n" "note" entry (file "~/org/inbox.org") "* %? :NOTE:
%U
%a
:CLOCK:
class Migration(DataMigration):
def forwards(self, orm):
for todo in orm.Todo.objects.all():
if todo.all_day or todo.location:
obj = orm.Event()
obj.all_day = todo.all_day
obj.location = todo.location
obj.end_date = todo.due_date
else:
class Todo(models.Model):
title = models.CharField(max_length=128)
owner = models.ForeignKey(User)
body = models.TextField(blank=True, null=True)
due_date = models.DateTimeField(blank=True, null=True)
start_date = models.DateTimeField(blank=True, null=True)
date_created = models.DateTimeField(auto_now_add=True)
location = models.CharField(max_length=128, blank=True, null=True)
all_day = models.BooleanField(default=False)
@trepca
trepca / counter.py
Created May 21, 2011 20:58
Sharded counters for Django
# -*- coding: utf-8 -*-
"""Efficient django counters that support hundreds updates/sec
Based on Google Appengine sharded counters http://code.google.com/appengine/articles/sharding_counters.html
"""
from django.db import models
from django.db.models import Sum, F
import random
from django.db import transaction, IntegrityError
from django.core.cache import cache