Skip to content

Instantly share code, notes, and snippets.

View simonmcmanus's full-sized avatar

Simon McManus simonmcmanus

View GitHub Profile
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<title>W3Schools Home Page</title>
<link>http://www.w3schools.com</link>
<description>Free web building tutorials</description>
<item>
<title>RSS Tutorial</title>
<link>http://www.w3schools.com/rss</link>
@simonmcmanus
simonmcmanus / gist:3553523
Created August 31, 2012 14:27
rsstester
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<title>W3Schools Home Page</title>
<link>http://www.w3schools.com</link>
<description>Free web building tutorials</description>
<item>
<title>RSS Tutorial</title>
<link>http://www.w3schools.com/rss</link>
<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Twitter Stream no @replies/RT</title>
<description>Pipes Output</description>
<link>http://pipes.yahoo.com/pipes/pipe.info?_id=94deb73d5821d47b8d4cea719cf49ba7</link>
<atom:link rel="next" href="http://pipes.yahoo.com/pipes/pipe.run?_id=94deb73d5821d47b8d4cea719cf49ba7&amp;_render=rss&amp;page=2"/>
<pubDate>Tue, 04 Sep 2012 08:44:37 +0000</pubDate>
<generator>http://pipes.yahoo.com/pipes/</generator>
<item>
<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Twitter Stream no @replies/RT</title>
<description>Pipes Output</description>
<link>http://pipes.yahoo.com/pipes/pipe.info?_id=94deb73d5821d47b8d4cea719cf49ba7</link>
<atom:link rel="next" href="http://pipes.yahoo.com/pipes/pipe.run?_id=94deb73d5821d47b8d4cea719cf49ba7&amp;_render=rss&amp;page=2"/>
<pubDate>Tue, 04 Sep 2012 08:44:37 +0000</pubDate>
<generator>http://pipes.yahoo.com/pipes/</generator>
<item>
@simonmcmanus
simonmcmanus / gist:4474133
Created January 7, 2013 10:49
Example embedding the GoSquared dashboard.
<!DOCTYPE html>
<html>
<head>
<title>Dashboard integration example</title>
<link rel="stylesheet" href="https://www.gosquared.com/dashboard/css/dashboard.css">
</head>
<body>
<div id="dashboard"></div>
<script>
var GS = {
var fs = require('fs');
var cheerio = require('cheerio');
exports.version = '0.7.7';
var checkForInputs = function($node, data) {
$node.each(function(i, elem) {
if(this[0].name === 'input') {
$(this[0]).attr('value', data);
}else {
$(this[0]).html(data);
@simonmcmanus
simonmcmanus / reqpage.js
Last active December 13, 2015 23:49
Using Require.js with Page.js to do progressive enhancement nicely.
require(["jquery", "utils", "routeHelpers"], function() {
// get new page fragment and swap it out.
var frax = function(context, next) {
if(!context.init) { // No need to fetch the page as its the initial page load and markup will be in the page.
$.get(context.canonicalPath+'?_frax=true', function(markup) { // gets the page without the layout.
$('#container').html(markup);
next();
});
}else {
@simonmcmanus
simonmcmanus / ExampleUsage.js
Last active December 14, 2015 07:19
An example of using Blend.
/*
Blend middleware for Express.js
Exposes not only the data but also the object which would get passed to the templating language so that we can do the rendering in the browser.
An example usage:
*/
res.blend({
@simonmcmanus
simonmcmanus / blend.js
Last active December 15, 2015 10:29
Get an API for free with Blend. After calling the middleware just call res.blend()
var _blend = function(req, res, next) {
res.blend = function(params) {
params.buildData(params.params, function(e, d) {
if(req.headers['content-type'] === 'application-json') {
res.json(d);
} else { // render html
params.buildSelectors(d, function(selectors) {
if(req.headers['content-type'] === 'sizlate') {
var options = {
@simonmcmanus
simonmcmanus / frax.js
Last active December 15, 2015 10:29
PJAX as Page.js middleware.
var frax = function(context, next) {
if(!context.init) {
$.get(context.canonicalPath+'?_pjax=true', function(markup) {
if(context.delay) {
context.pending = markup;
}else {
context.container.html(markup); // cached $('#container')
}
next();
});