This file contains 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
// Requires jQuery | |
// KeyUP | |
$($(document).data("events").keyup).each(function(e){ console.log(this.data); }); | |
// KeyDOWN (MOS default) | |
$($(document).data("events").keydown).each(function(e){ console.log(this.data); }); |
This file contains 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
{% extends parameters.print ? "printbase" : "base" %} | |
{% block extrastyles %} | |
@page { margin: 0px; } | |
body { | |
margin: 0; | |
padding: 1px; <!-- You need this to make the printer behave --> | |
} | |
.store { page-break-after: always; margin-bottom: 40px; } | |
.receipt { | |
font: normal 10pt 'Helvetica Neue',Helvetica,Arial,sans-serif; |
This file contains 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
https://east3.merchantos.com/API/Account/36836/Item.json?or=systemSku~pearl|description~pearl | |
{"httpCode":"500","httpMessage":"Internal Server Error","message":"findAllByFieldMatch got search for \"systemSku~pearl\". Did you mean: systemSku?"} |
This file contains 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
$(document).ready(function() { | |
// Only find headings within the article ID to save overhead | |
// (we don't care about headings outside of the article for the TOC | |
$('#article').each(function() { | |
var article = $(this); | |
var toc = $('<div class="toc"><h3>Table of Contents</h3><ul></ul></div>'); | |
var toc_ul = toc.find('ul'); | |
article.find('h2').each(function() { | |
// Add a ID (anchor) to each heading |
This file contains 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
<% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<% pages.each do |p| %> | |
<url> | |
<loc>http://youdomain.com/<%=p.destination_path.gsub('/index.html','')%></loc> | |
<priority>0.7</priority> | |
</url> | |
<% end %> | |
</urlset> |
This file contains 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
<% | |
entries = [] | |
pages = sitemap.resources | |
pages = pages.find_all{|p| p.source_file.match(/\.html/) && !p.directory_index? && p.data.hide_listing != true } | |
pages.each do |article| | |
file = File.open(article.source_file,'r') | |
file_contents = file.read.split('---').last.gsub(/\t|\n/,' ') | |
content = Nokogiri::HTML(file_contents).xpath("//text()").to_s |
This file contains 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
require 'rubygems' | |
require 'indextank' | |
api_client = IndexTank::Client.new 'http://:[email protected]' | |
help_index = api_client.indexes 'help' | |
require 'json' | |
# Build fresh sitemap.json | |
# `middleman build -g help/sitemap.json` |
This file contains 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
// Assumes availability of jQuery... | |
function generate_toc() { | |
// Get the headings | |
var body = $('body'); | |
var headings = body.find('h2'); | |
// We don't need a table of contents if we don't have any headings | |
if (headings.length == 0) return false; |