chadmaughan.com

Octopress Bitbucket Plugin

Quick plugin (modified from the github.js plugin) to provide links to your Bitbucket Repos.

source/javascripts/bitbucket.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var bitbucket = (function(){
  function render(user, target, repos){
    var i = 0, fragment = '', t = $(target)[0];

    for(i = 0; i < repos.length; i++) {
      fragment += '<li><a href="https://bitbucket.org/'+user+'/'+repos[i].name+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
    }
    t.innerHTML = fragment;
  }
  return {
    showRepos: function(options){
      $.ajax({
          url: "https://api.bitbucket.org/1.0/users/"+options.user+"?callback=?"
        , type: 'jsonp'
        , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
        , success: function(data) {
          var repos = [];
          if (!data || !data.repositories) { return; }
          for (var i = 0; i < data.repositories.length; i++) {
            if (options.skip_forks && data.repositories[i].fork) { continue; }
            repos.push(data.repositories[i]);
          }
          repos.sort(function(a, b) {
            var aDate = new Date(a.last_updated).valueOf(),
                bDate = new Date(b.last_updated).valueOf();

            if (aDate === bDate) { return 0; }
            return aDate > bDate ? 1 : -1;
          });

          if (options.count) { repos.splice(options.count); }
          render(options.user, options.target, repos);
        }
      });
    }
  };
})();

And the associated HTML file (remove extra spaces - ie ‘{ %’ to ‘{%’ and ‘{ {’ to ‘{{’)

source/_includes/asides/bitbucket.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ % if site.bitbucket_user %}
<section>
  <h1>Bitbucket Repos</h1>
  <ul id="bb_repos">
    <li class="loading">Status updating...</li>
  </ul>
  { % if site.bitbucket_show_profile_link %}
  <a href="https://bitbucket.org/{ {site.bitbucket_user}}">@{ {site.bitbucket_user}}</a> on Bitbucket
  { % endif %}
  <script type="text/javascript">
    $.domReady(function(){
        if (!window.jXHR){
            var jxhr = document.createElement('script');
            jxhr.type = 'text/javascript';
            jxhr.src = '{ {root_url}}/javascripts/libs/jXHR.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(jxhr, s);
        }

        bitbucket.showRepos({
            user: '{ {site.bitbucket_user}}',
            count: { {site.bitbucket_repo_count}},
            target: '#bb_repos'
        });
    });
  </script>
  <script src="{ { root_url }}/javascripts/bitbucket.js" type="text/javascript"> </script>
</section>
{ % endif %}

I’ll issue a pull request after I’ve cleaned it up and reviewed.

More Daring Fud

Yah, because Apple never rushes and releases anything. Wait, hang on. My iPad screen is flickering again. I’ll finish this post once I update to iOS 4.3.1.

P.S. - anyone else notice how angry the CMO (Chief Mactard Officer) has been recently? It’s almost like Google stole his girlfriend and all he can do is resort to snarky criticism to boost his self esteem.

Stiglitz Is a Moron

Wow, and he’s an economics professor.

He forgets that we live in a globalized world and that capital flows where it is the most productive. In the US (with the second highest corporate tax rate) it flows out (and doesn’t come back in - except for tax holidays).

First Nobel Laureate to Attack Another Country?

Quote of the day:

“The president does not have power under the Constitution to unilaterally authorize a military attack in a situation that does not involve stopping an actual or imminent threat to the nation.”

Fantastic stuff.

Wars in a Vacuum

Peter Berger is looking at these two military actions in a vacuum.

The high level of anti-Americanism in the Muslim world that was generated by the Iraq War is unlikely to be replicated by U.S. military action against Libya, because Gadhafi is widely reviled in the Arab world.

The Arab world didn’t like Sadaam Hussein either.

The real reason we have a strong coalition for action in Libya is because there are real, substantive movements towards democracy in the Arab world. A lack of action in Libya would slow that progress. But could we have had real, substantive progress without our unilateral actions in Iraq?

Conservatives Like NPR Too

I identify most with the Libertarian party than others (except for the weird stuff). I’m definitely a fiscal conservative, a “supply-sider” (I think Art Laffer should be president). Having said all that, I love NPR. Absolutely love it.

NPR’s audience keeps expanding because Americans want more than toxic political attacks. They want news.

I agree.

However, I still think they don’t need public money. Lower my taxes and then I’ll contribute more to my station’s fund drives.

Iraq War Role in Arab Revolutions

I keep waiting for some of the pundits or mainstream media to comment on this, but nothing. So here goes. What role did the Iraq War have in the current Arab revolutions?

Here is what George W. Bush had to say in his speech The Struggle for Democracy in Iraq concerning the insurgents:

They understand what is at stake in Iraq. They know that as democracy takes root in that country, their hateful ideology will suffer a devastating blow, and the Middle East will have a clear example of freedom and prosperity and hope.

Most people have argued that the internet was the key catalyst in these revolutions. Yes, Twitter & Facebook had a role in them, but wasn’t that mostly logistical (ie - getting the word out on where the next protest would be)? Where did the real motivation and inspiration for freedom come from?

I would suggest that some of that inspiration came from Al Jazeera and it’s coverage of Iraq’s post war struggles for democracy. Now, Iraq is no “clear example” of a democracy (it only took 8 months to finally form a coalition government), but it’s an example of democracy nonetheless. Contrast a struggling Iraq democracy with the defacto dictatorships that have currently been toppled and Iraq looks pretty good (remember, Iraq also had a deranged, autocratic leader much like Tunisia & Egypt). At least Iraq is making it’s own destiny.

Here’s what the NY Times had to say about Al Jazeera’s role in the current revolutions:

The protests rocking the Arab world this week have one thread uniting them: Al Jazeera, […] whose aggressive coverage has helped propel insurgent emotions from one capital to the next.

Al Jazeera’s coverage of Iraq and its electoral procedures has certainly not been as aggressive as its coverage of the current revolutions. However, I think a small part of these revolutions owe their success to Iraq’s struggles for democracy. And that struggle is indebted to the Iraq war and the toppling of Sadaam Hussein.

I’m not sure the it was worth the estimated $6,300 per U.S. citizen but I think that it certainly, in some way, facilitated these revolutions.