Skip to content

Instantly share code, notes, and snippets.

View simonmcmanus's full-sized avatar

Simon McManus simonmcmanus

View GitHub Profile
@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 / 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 {
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 / 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 = {
<?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: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" 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" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>RSS Example</title>
<description>This is an example of an RSS feed</description>
<link>http://www.domain.com/link.htm</link>
<lastBuildDate>Mon, 28 Aug 2006 11:12:55 -0400 </lastBuildDate>
<pubDate>Tue, 29 Aug 2006 09:00:00 -0400</pubDate>
/*
Dear Twitter,
According to your docs (https://dev.twitter.com/docs/rate-limiting) users authenticated with oAuth should see a rate limit of 350 requests per hours against the REST API.
Unfortunately despite trying numerous libraries (as suggested in your docs) I have been unable to acieheve this limit.
I only ever see 150. I have read many of the discussions on the forum which suggest that my oAuth authorisation has not been sucessful. I can however see that the rate limit is not shared accross other users on my IP, each user that logs in gets 150 request per hour. The x-warning field is also never present in the returned data. This suggests to me that my users have sucessfully logged in.