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/bin/env python | |
import simplejson, urllib2 | |
DATA_URL = "http://election2008.s3.amazonaws.com/votes/us-pres.json" | |
data = simplejson.loads(urllib2.urlopen(DATA_URL).read()) | |
for candidate in data["totals"]["races"]["President"][""]["votes"]: | |
name = data["candidates"][candidate["id"]].split("|")[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
#!/usr/bin/env python | |
# Drop.io Upload Tool for GNOME | |
# Copyright (C) 2008 Ryan Paul (SegPhault) | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 2 of the License, or | |
# (at your option) any later version. | |
# |
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
/* | |
* Main.fx | |
* | |
* Created on Dec 5, 2008, 11:27:35 AM | |
*/ | |
package testapplication; | |
import javafx.scene.*; | |
import javafx.scene.image.*; |
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
" | |
" Plugin: VimGist | |
" Author: SegPhault (Ryan Paul) - 12/08/2008 | |
" Description: This plugin integrates support for GitHub Gist in Vim | |
" | |
python << EOF | |
import vim, sys, os.path | |
sys.path.append("/home/segphault/project/utilities/gist") |
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
# Each individual GTK+ widget has a completely different set of functions for | |
# manually setting an icon. It also has to be done differently depending on | |
# whether the icon is being set by stock name or by filename. These | |
# inconsistencies make GTK+ very frustrating. | |
def set_icon_named(name, widget, size=gtk.ICON_SIZE_MENU): | |
if isinstance(widget, gtk.ImageMenuItem): | |
if name.startswith("/"): widget.get_image().set_from_file(name) | |
else: widget.get_image().set_from_icon_name(name, size) |
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 setup_menus(self): | |
ui_string = """ | |
<ui> | |
<menubar name="menubarMain"> | |
<menu action="menuFile"> | |
<menuitem action="Capture"/> | |
<menuitem action="Open"/> | |
<menuitem action="Save"/> | |
<menuitem action="Upload"/> | |
<separator/> |
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
Seed.import_namespace("Gtk"); | |
Seed.import_namespace("Gdk"); | |
Seed.import_namespace("Gio"); | |
Seed.include("pretty.js"); | |
Gtk.init(null, null); | |
var window = new Gtk.Window({"title": "Twitter Search", "border-width": 5}); | |
window.signal.hide.connect(Gtk.main_quit); | |
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
Seed.import_namespace("Gtk"); | |
Gtk.init(null, null); | |
Gtk.Container.prototype.clear = function() { | |
var container = this; | |
container.foreach(function(i) {container.remove(i)}); | |
} | |
Gtk.Container.prototype._add = Gtk.Container.prototype.add; |
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/bin/env python | |
import urllib2, re | |
from BeautifulSoup import BeautifulStoneSoup | |
ARTICLE_URLS = """ | |
<PUT URLS HERE, ONE PER LINE> | |
""".strip().split("\n") | |
xml = BeautifulStoneSoup(urllib2.urlopen("http://feeds.arstechnica.com/arstechnica/journals/openended")) |
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
sub _get_entries { | |
my $class = shift; | |
my %param = @_; | |
my($blog_id, $user, $pass, $num, $titles_only) = | |
@param{qw( blog_id user pass num titles_only )}; | |
my $obj_type = $param{page} ? 'page' : 'entry'; | |
my $mt = MT::XMLRPCServer::Util::mt_new(); ## Will die if MT->new fails. | |
my($author, $perms) = $class->_login($user, $pass, $blog_id); | |
die _fault(MT->translate("Invalid login")) unless $author; | |
die _fault(MT->translate("Permission denied.")) unless $perms && $perms->can_create_post; |
OlderNewer