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
#!/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): |
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
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) { |
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
test |
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 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) |
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 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) |
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
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 |
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
; 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: |
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 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: |
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 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) |
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
# -*- 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 |
OlderNewer