This file contains hidden or 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 twitter.api import Twitter | |
USERNAME = 'r1cky' # set to your/any username | |
twitter = Twitter() # username/password not required for these calls | |
friends = twitter.friends.ids(screen_name=USERNAME) | |
followers = twitter.followers.ids(screen_name=USERNAME) | |
guilty = [x for x in friends if x not in followers] | |
print "There are %s tweeps you follow who do not follow you" % len(guilty) |
This file contains hidden or 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 logging | |
import random | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.options | |
import tornado.web | |
from tornado.options import define, options |
This file contains hidden or 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
/* | |
* Proof of Concept | |
* webkit specific library that (eventually) implements the jQuery API ~ish | |
*/ | |
(function( window, undefined ) { | |
var webkitQuery = function (selector, context) { | |
return new WebkitQuery(selector, context); | |
}; |
This file contains hidden or 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 getOS() { | |
var os = [ | |
['Windows 3.11', /Win16/i], | |
['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/i], | |
['Windows 98', /(Windows 98)|(Win98)/i], | |
['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/i], | |
['Windows XP', /(Windows NT 5.1)|(Windows XP)/i], | |
['Windows Server 2003', /(Windows NT 5.2)/i], | |
['Windows Vista', /(Windows NT 6.0)/i], | |
['Windows 7', /(Windows NT 6.1)/i], |
This file contains hidden or 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 http://delete.me.uk/2005/03/iso8601.html | |
Date.prototype.setISO8601 = function (string) { | |
var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" + | |
"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" + | |
"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?"; | |
var d = string.match(new RegExp(regexp)); | |
var offset = 0; | |
var date = new Date(d[1], 0, 1); |
This file contains hidden or 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
In [1]: from testapp.models import ModelA | |
In [2]: a = ModelA.objects.all()[0] | |
In [3]: a.my_related_cs | |
Out[3]: <django.db.models.fields.related.RelatedManager object at 0x101e1ca10> | |
In [4]: a.my_related_bs | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) |
This file contains hidden or 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 settings = { | |
agile_backlog: true | |
}; | |
var css = ".graph { width: 300px; height: 300px; float: left; } .graph canvas.overlay { background: none repeat scroll 0 0 rgba(0, 0, 0, 0) !important; }"; | |
$('head').append($('<style>').text(css)); | |
function agileBacklog() { | |
if(settings.agile_backlog) { | |
var $wb = $('td.bz_status_whiteboard_column'); |
This file contains hidden or 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 fabric.api import local | |
def get_db_dump(): | |
local('scp [email protected]:/data/www/sumodump.sql.gz .') | |
local('gunzip sumodump.sql.gz') | |
def load_dump(): | |
local('mysql -e "DROP DATABASE kitsune;"') | |
local('mysql -e "CREATE DATABASE kitsune;"') | |
local('mysql kitsune < sumodump.sql') |
This file contains hidden or 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
SELECT | |
(extract( year from created )) AS `year`, | |
(extract( day from created )) AS `day`, | |
(extract( month from created )) AS `month`, | |
COUNT(`questions_question`.`created`) AS `count` | |
FROM `questions_question` | |
INNER JOIN `auth_user` | |
ON (`questions_question`.`creator_id` = `auth_user`.`id`) | |
WHERE (`auth_user`.`is_active` = 1 | |
AND `questions_question`.`created` >= '2011-01-01 00:00:00' |
This file contains hidden or 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
# Requirements: | |
# pip install requests==1.1.0 | |
import requests | |
repos = [ | |
'bedrock', | |
'django-browserid', | |
'input.mozilla.org', |
OlderNewer