Skip to content

Instantly share code, notes, and snippets.

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'
#!/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
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: &lt;/ars:img&gt;<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)
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);
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
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
<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>
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);
};
/*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');
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();
});
});
});
});