Skip to content

Instantly share code, notes, and snippets.

url.redirect = (
"^/kurttest/(.*)" => "/index.php?hi=$1",
"^/infotech/(.*)" => "/business/$1",
"^/index.php" => "/",
"^/(.*)/index((\.ars)|(\.php))" => "/$1",
"/(.*)/((in_content_promo)|(content_inset_promo))\.php" => "/$1"
)
<?
$by_category = array();
$by_category_flat = array();
<mt:TopLevelCategories trim="1">
if(!array_key_exists('<mt:CategoryBasename separator="-" encode_php="q" />', $by_category)){
$by_category['<mt:CategoryBasename separator="-" encode_php="q" />'] = array();
$by_category['<mt:CategoryBasename separator="-" encode_php="q" />']['entries'] = array();
}
$by_category['<mt:CategoryBasename separator="-" encode_php="q" />']['include_on_fp'] = <mt:if tag="CategoryIncludeOnFrontpage">true<mt:Else>false</mt:If>;
$by_category['<mt:CategoryBasename separator="-" encode_php="q" />']['url'] = '<mt:ArchiveLink type="Category" encode_php="q" />';
<mt:SetVarTemplate name="main_menu">
<mt:CategoryBasename default="no-cat" separator="-" setvar="tl_basename" /><!-- <mt:var name="tl_basename" /> -->
<ul id="primary-navigation">
<li<mt:if var="tl_basename" eq="no-cat"> class="current-selection"</mt:if>><a href="<mt:BlogURL />">All</a></li>
<li<mt:if var="tl_basename" eq="apple"> class="current-selection"</mt:if>><a href="<mt:BlogURL />apple/">Apple</a></li>
<li<mt:if var="tl_basename" eq="business"> class="current-selection"</mt:if>><a href="<mt:BlogURL />business/">Business</a></li>
<li<mt:if var="tl_basename" eq="gadgets"> class="current-selection"</mt:if>><a href="<mt:BlogURL />gadgets/">Gadgets</a></li>
<li<mt:if var="tl_basename" eq="gaming"> class="current-selection"</mt:if>><a href="<mt:BlogURL />gaming/">Gaming</a></li>
<li<mt:if var="tl_basename" eq="hardware"> class="current-selection"</mt:if>><a href="<mt:BlogURL />hardware/">Hardware</a></li>
<li<mt:if var="tl_basename" eq="microsoft"> class="current-sele
<mt:SetVarBlock name="cat_key"><mt:if tag="CategoryID">cat-<mt:CategoryID /><mt:Else>cat-non</mt:if></mt:SetVarBlock>
<!-- Category include: <mt:var name="cat_key" /> -->
<mt:Include module="Primary Navigation" cache="1" ttl="10" ssi="1" cache_key="$cat_key" />
<mt:SetVarTemplate name="main_menu">
<mt:CategoryBasename default="no-cat" separator="-" setvar="tl_basename" /><!-- <mt:var name="tl_basename" /> -->
<ul id="primary-navigation">
<li<mt:if var="tl_basename" eq="no-cat"> class="current-selection"</mt:if>><a href="<mt:BlogURL />">All</a></li>
<li<mt:if var="tl_basename" eq="apple"> class="current-selection"</mt:if>><a href="<mt:BlogURL />apple/">Apple</a></li>
<li<mt:if var="tl_basename" eq="business"> class="current-selection"</mt:if>><a href="<mt:BlogURL />business/">Business</a></li>
<li<mt:if var="tl_basename" eq="gadgets"> class="current-selection"</mt:if>><a href="<mt:BlogURL />gadgets/">Gadgets</a></li>
<li<mt:if var="tl_basename" eq="gaming"> class="current-selection"</mt:if>><a href="<mt:BlogURL />gaming/">Gaming</a></li>
<li<mt:if var="tl_basename" eq="hardware"> class="current-selection"</mt:if>><a href="<mt:BlogURL />hardware/">Hardware</a></li>
<li<mt:if var="tl_basename" eq="microsoft"> class="current-sele
com.arstechnica.common.journals_and_popular = function(){
$('#most-popular-and-journals-box-header li').live('click', function(){
$('#most-popular-and-journals-box-header li').removeClass('selected');
$(this).addClass('selected');
var target = '#' + $(this).attr('id').replace('-tab', '-box');
$('#most-popular-and-journals-box > div')
.filter('#most-popular-and-journals-box-header').hide()
.filter(target).show();
});
};
kurt@ubuntu:~/lighthouse-git$ ./bin/lh-git init --lighthouse-account <snip> --lighthouse-api-key <snip> --lighthouse-project 24284
Using project 24284
1) I don't want to work out of a bin
2) Todo
3) New Tickets
4) Stuff Clint should be working on
5) Upcoming
6) Clint's Tickets
7) Important Issues
8) Aurich's Tickets
def from_url(url)
raise "No url specified" if url.nil?
easy = Curl::Easy.perform(url) do |c|
c.headers["If-Modified-Since"] = @last_modified unless @last_modified.nil?
c.headers["If-None-Match"] = @etag unless @etag.nil?
c.follow_location = true
end
if easy.response_code == 200
@source_url = url
parse_response(easy)
<div class="news-item-figure" style="width:640px;">
<div class="news-item-figure-image">
<img src="http://write.arstechnica.com/published/cdn/assets/2009/02/kindle-listing-thumb-640xauto-2497.jpg" alt="Evolution yields revolution: the Kindle 2" />
</div>
munch do |h|
(h / 'div.img').each do |img|
src = (img % 'img').attributes['src']
(img / 'img').remove
text = img.inner_html
img.swap("<div class=\"ImageRight\"><div><img src=\"#{src}\" /></div><div>#{text}</div></div>")
end
end