Skip to content

Instantly share code, notes, and snippets.

@ashaw
ashaw / gist:256299
Created December 14, 2009 18:44
a polltracker api in a movable type template
<?php
//pollxmlgen - a brute force poll api generator...
//@author al shaw
//sept 2009
//---global stuff--
error_reporting(0);
//---deal with query strings
$challenger1 = $_GET['challenger1'];
@ashaw
ashaw / gist:259063
Created December 17, 2009 22:00
get yr last 1000 tweets
#!/usr/bin/env ruby
(1..50).each {|i| `curl -u username:pass http://twitter.com/statuses/user_timeline.xml?page=#{i} -o twitter_page_#{i}.xml`}
/*
ajaxPaginate (will_paginate via jQuery)
@author Al Shaw for TPM PollTracker (http://polltracker.talkingpointsmemo.com) <al@talkingpointsmemo.com>
December 2009
USAGE!
Stick this in your page somewhere, with the div you want to inject the new content into as the argument.
Here, the injected_div is `.index_polls`. For it to work, you need to have a raw version of your content to inject.
The raw version should take the format <page>?format=list_only&page=[pagenumber].
require 'will_paginate'
# patch WillPaginate to allow reverse pagination
# only do this if you're not showing the page numbers themselves
# pass option :reverse => true to reverse paginate, and don't forget to pass custom labels
class WillPaginate::LinkRenderer
def html_attributes
return @html_attributes if @html_attributes
@html_attributes = @options.except *(WillPaginate::ViewHelpers.pagination_options.keys - [:class])
Thoughts on twitter attribution
via Used when attributing link/tweet/idea to others,
but attributing tweet either quoted from
linked work (not tweet) or originally written.
Attribution in form of twitter username
or full real name.
Links gathered from twitter users to *their own*
blog or site do not require via. This

BLOCKERS

  • less verbose template code
  • authentication - basic?
  • pretty default template. 960gs? how to integrate css?

NICE TO HAVE

  • work on assignment/unassignment on manage homepage.. make everything work from one form
  • validate homepage paths for directory-ness and if the location actually exists..
<!-- three thoughts for a Homer templating DSL called 'Ho' -->
<!-- currently -->
<div id="feature">
<% feature = Ho.new(@homepage,'feature') %> <!-- 'in-slot' init -->
<%= feature.title %>
<%= feature.body %>
</div>
#!/usr/bin/env ruby
# find first followers
require 'rubygems'
require 'twitter'
begin
USERNAME = ARGV[0].to_s
curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'
#State,attribute
#California,sunshine
#California,beaches
#Texas,oil
#Texas,rock_festivals
s = TableFu.new(csv)
s.faceted_by("State").each do |state|
puts state.row
end