Skip to content

Instantly share code, notes, and snippets.

@import "css3";
@include border-radius(10px);
border: 1px solid yellow;
color: white;
position: relative;
min-height: 500px;
overflow: hidden;
background-color: #003300;
margin: 3% 30%;
module Rankable
extend ActiveSupport::Concern
included do
field :ratings_value_sum, :type => Integer, :default => 0
field :ratings_count, :type => Integer, :default => 0
embeds_many :ratings
end
class SecureSomething
include Mongoid::Document
field :private_field
field :public_field, :accessible => true
protected_by_default!
end
var ars = new Ars("/", "1272473031.21335", "beer");
asyncTest("a consumer boots", function() {
expect(1);
ars.boot(function(){
ok(ars.sections instanceof Object, "sections populated");
start();
});
});
asyncTest("a user requests a list of entries", function() {
asyncTest("a user removes a bookmark", function() {
ars.add_bookmark(ars.current_entries[0], function(bookmark){
ars.delete_bookmark(bookmark, function(){
ars.get_bookmarks(function(){
ok(ars.bookmarks[bookmark.target] == undefined, "bookmark was removed");
start();
});
});
});
});
/*jslint debug: false, passfail: false, onevar: true,
white: false, regexp: false, nomen: false, plusplus: false, browser: true */
/*global ars, openDatabase */
ars.api.offline = {
available : false,
db : openDatabase('ars', '0.1', 'Ars Technica Offline Content', 5 * 1024 * 1024),
init : function(){
var db = ars.api.offline.db;
db.transaction(function(tx){
tx.executeSql('DROP TABLE IF EXISTS entries');
overrides : {
list_entries : function(options_or_callback, callback){
var params = '', extracted, cb;
extracted = ars.api.extract_params_and_callback(options_or_callback, callback);
cb = function(entries){
ars.api.offline.store_query(params, entries);
extracted[1](entries);
};
<markdown>
A whole bunch of markdown formatted text
</markdown>
<a href="..." title="..." name="..."></a>
<video class="(right|left|centered)" src="http://youtube.com/link/to/video/page" width="600" height="350">This is a caption</video>
<image class="(right|left|centered)" src="..." large-src="..." href="..." credit-url="..." credit="...">This is a caption</image>
class Video < Rule
tag 'video'
type 'block-text-container'
required_attributes :src
optional_attributes :class, :width
process do |node|
"<div class=\"video\"><strong>#{node.attributes['src']}</strong>: #{node.children}</div>"
end
class Rule
def self.type(t)
@type = t
Rules.register(self)
end
def self.required_attributes(*attrs)
@attributes ||= {}
@attributes[:required] = attrs.map(&:to_s)
end