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
cd my_download_dir | |
curl http://apps.sd.gov/applications/ST12ODRS/LobbyistViewlist.asp?start=[1-8101:20] -o "lobby_#1.html" | |
# get a cup of coffee | |
cat lobby*.html > master.html # on mac/linux, on windows try copy lobby*.html master.html | |
----- | |
Then open master.html in a text editor, do some smart bulk find and replaces, and you'll be in business. After opening the cleaned up file in Excel, you'll need to un-merge the cells and do a little more cleanup, but it works. |
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 YourResource(ModelResource): | |
def wrap_view(self, view): | |
""" | |
Wraps views to return custom error codes instead of generic 500's | |
""" | |
@csrf_exempt | |
def wrapper(request, *args, **kwargs): | |
try: |
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
<html> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$.getJSON('http://search.twitter.com/search.json?q=earthquake&lang=en&callback=?', function(data) { | |
var data = data.results; | |
var html = "<ul>"; | |
for(var i=0; i<data.length; i++) { | |
html += "<li><a href='http://twitter.com/" + data[i].from_user + "'>@" |
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
var stateToAP = function(state) { | |
var STATES = [ | |
["Alabama", "AL", "Ala.", 1], | |
['Alaska', "AK", "Alaska", 2], | |
["Arizona", "AZ", "Ariz.", 4], | |
["Arkansas", 'AR', "Ark.", 5], | |
["California", "CA", "Calif.", 6], | |
["Colorado", "CO", "Colo.", 8], | |
["Connecticut", "CT", "Conn.", 9], | |
["Delaware", "DE", "Del.", "10"], |
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
<?php | |
/* use a regular expression to remove inline comments. in this case, everything gets removed if it's inside double at signs. @@so you could CQ this@@ */ | |
function filter_remove_inline_comments($content) { | |
return preg_replace('/@@.*?@@/', '', $content); | |
} | |
add_filter('the_content', 'filter_remove_inline_comments', 5); | |
?> |
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
import httplib2 | |
import urllib | |
try: | |
import json | |
except ImportError: | |
import simplejson as json | |
# create a global Http object so we can reuse connections | |
http = httplib2.Http('.cache') |
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
Suggestions from the 11 hackers at the table: | |
* Use connection pooling (pgpool). | |
* Don't expect reporters to get excited until you can show them something. (Find a way to appeal to reporters interests.) | |
* Only update what's changed. (e.g. on election results: show changes, not raw numbers) | |
* Use the AP's "dbready" format for election results. | |
* Use CSV for everything. | |
* Use pdb with runserver for debugging. | |
* Beware circular imports when using Haystack. | |
* Make the case for building news apps with government data. (Niran will provide numbers showing that people look at it.) |
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 menu_order_filter($menu) { | |
// | |
// reorder the menu here by operating on $menu | |
// which is an array with position => 'url'; | |
// separators will appear as | |
// 'separator1', 'separator2' ... 'separator-last' | |
// | |
// example: | |
// Array | |
// ( |
NewerOlder