This file contains hidden or 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 "css3"; | |
@include border-radius(10px); | |
border: 1px solid yellow; | |
color: white; | |
position: relative; | |
min-height: 500px; | |
overflow: hidden; | |
background-color: #003300; | |
margin: 3% 30%; |
This file contains hidden or 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
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 |
This file contains hidden or 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 SecureSomething | |
include Mongoid::Document | |
field :private_field | |
field :public_field, :accessible => true | |
protected_by_default! | |
end |
This file contains hidden or 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 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() { |
This file contains hidden or 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
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(); | |
}); | |
}); | |
}); | |
}); |
This file contains hidden or 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
/*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'); |
This file contains hidden or 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
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); | |
}; |
This file contains hidden or 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
<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> |
This file contains hidden or 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 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 |
This file contains hidden or 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 Rule | |
def self.type(t) | |
@type = t | |
Rules.register(self) | |
end | |
def self.required_attributes(*attrs) | |
@attributes ||= {} | |
@attributes[:required] = attrs.map(&:to_s) | |
end |