Skip to content

Instantly share code, notes, and snippets.

require MT::Association;
require MT::Role;
my @roles = MT::Role->load({}, { join => MT::Association->join_on('role_id', { author_id => $user->id }) });
my $security_groups = join(',', keys( %{{ map { uri_escape($_->name) => 0 } @roles }} ));
Hackintosh:one-counter kurt$ heroku console
Ruby console for deep-journey-73.heroku.com
>> Tweets.all.inspect
NameError: uninitialized constant Tweets
>> Tweet.all.inspect
=> "[#<Tweet id: 1, text: \"2 Lovely strawberry yogurt!\", twitter_id: 108963797, user_id: 1, created_at: \"2009-04-29 22:24:52\", updated_at: \"2009-04-29 22:47:05\">, #<Tweet id: 2, text: \"5 Life cereal w/milk\", twitter_id: 108797190, user_id: 1, created_at: \"2009-04-29 19:16:12\", updated_at: \"2009-04-29 22:47:05\">, #<Tweet id: 3, text: \"5 oatmeal, butter, brown sugar\", twitter_id: 109676468, user_id: 1, created_at: \"2009-04-30 13:42:00\", updated_at: \"2009-04-30 14:14:05\">, #<Tweet id: 4, text: \"4 wheat thins\", twitter_id: 109028961, user_id: 1, created_at: \"2009-04-29 23:27:05\", updated_at: \"2009-04-30 14:14:05\">, #<Tweet id: 5, text: \"8 beef rice dinner thing\", twitter_id: 109028197, user_id: 1, created_at: \"2009-04-29 23:26:18\", updated_at: \"2009-04-30 14:14:05\">, #<Tweet id: 6, text: \"4 Wheat thins\", twitter_
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<!-- Meta Data -->
<title>Classically trained: Ars reviews Punch-Out for the Wii - Ars Technica</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
var query = document.location.search;
if (query) {
query = query.substr(1);
} else {
ls$Error.log("1x000", "Collect query parameters", "No query parameters found");
throw "No query parameters found";
}
var params = query.split("&");
var len = params === null ? 0 : params.length;
if (len < 1) {
$VAR1 = bless( { '_content' => '500 Can\'t locate object method "new" via package "LWP::Protocol::https::Socket" ', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal response', 'client-date' => 'Thu, 20 Aug 2009 17:53:38 GMT', 'content-type' => 'text/plain' }, 'HTTP::Headers' ), '_msg' => 'Can\'t locate object method "new" via package "LWP::Protocol::https::Socket"', '_request' => bless( { '_content' => '<complimentary_subscription><duration_quanti ty>7</duration_quantity><duration_units>days< /duration_units><feature_level>365</feature_l evel></complimentary_subscription>', '_uri' => bless( do{\(my $o = 'https://spreedly.com/api/v4/arstechnica-test /subscribers/SpreedlySubs::App::Server/compli mentary_subscriptions.xml')}, 'URI::https' ), '_headers' => bless( { 'user-agent' => 'libwww-perl/5.808', 'content-type' => 'application/xml' }, 'HTTP::Headers' ), '_method' => 'POST' }, 'HTTP::Request' ) }, 'HTTP::Response' );
// ==UserScript==
// @name Ars User Admin Link
// @namespace ars
// @include http://civis.arstechnica.com/users/1
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
# Comment out the next line if you don't want Cucumber Unicode support
require 'cucumber/formatter/unicode'
require 'webrat'
require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
Webrat.configure do |config|
config.mode = :mechanize
end
Feature: Browse frontpage
In order to find new and interesting content
Visitors should be able to
view the front page
Scenario: A new visitor visits the frontpage
Given I go to the homepage
Then I should see "Ars Technica" in the title
<?
$GLOBALS['entry'] = $entry;
$page_number = $_SERVER['PATH_INFO'];
$page_number = preg_replace("/[^0-9]/", '', $page_number);
if($page_number == '') $page_number = 1;
?>
<? $render->open_layout('standard'); ?>
<div id="news-item">
<?
$img = $entry->intro_image ? $entry->intro_image : $entry->listing_image;
Feature: Entry permalinks
In order to read content
Visitors should be able to
visit permalinks for entries
Scenario: View a short entry
Given I go to a short entry
Then I should see the standard entry elements
And I should not see the extended body