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
scripts = [ | |
{ | |
test: ()-> window.jQuery && window.jQuery.fn && window.jQuery.fn.jquery > "1.4.2" | |
src: 'http://localhost:3000/javascripts/jquery-1.4.2.min.js' | |
callback : ()-> | |
($ = window.jQuery).noConflict(1) | |
}, | |
{ | |
test: ()-> window.jQuery && window.jQuery.fn.lightbox_me | |
src: 'http://localhost:3000/javascripts/jquery.lightbox_me.js' |
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
#!/bin/sh | |
coffee -r ./app/scripts/production-replacements.coffee -c -o public/javascripts app/scripts/copypasta.coffee | |
git update-index --no-assume-unchanged public/javascripts/copypasta.js | |
git add -f public/javascripts/copypasta.js |
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 Image < Rule | |
IMG_ATTRIBUTES = [:src, :title, :alt] | |
tag 'ars:img' | |
description "An image with optional alignment, caption and link. <strong>Make sure you add a closing tag: </ars:img><br />The WYSIWYG editor in Movable Type screws up self closing tags and we wouldn't want to make more work for Eric</strong>." | |
required_attributes :src | |
optional_attributes :class, :width, :height, :href, :credit, :'credit-href', IMG_ATTRIBUTES | |
validate do |node| | |
errors = Helpers.validate_container(node) |
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 dashes = ""; var num = 20; while(--num) dashes += "-"; setInterval(function() { window.history.pushState("", "", '/sticky-history?' + dashes.slice(0, num % 20) + "foo" + dashes.slice(num % 20)); num++;}, 100); |
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 |
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
<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
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
/*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
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(); | |
}); | |
}); | |
}); | |
}); |