Skip to content

Instantly share code, notes, and snippets.

View simonmcmanus's full-sized avatar

Simon McManus simonmcmanus

View GitHub Profile
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
@simonmcmanus
simonmcmanus / hi.js
Last active December 17, 2015 21:09
Node.js/Clientside include
var sayHi = function() {
return 'Hi';
};
if(typeof exports === 'object'){
exports.sayHi = sayHi;
} else {
// your browser export
}
(function(exports){
exports.HOME = '/';
exports.LOGIN = '/login';
exports.USERS = '/users';
exports.USER = '/users/:user';
// also add URL functions here that can be shared between client and server.
exports.build = function(str, tokens) { .. };
})(typeof exports === 'undefined' ? namespace.urls={} : exports);
@simonmcmanus
simonmcmanus / ex.js
Last active December 17, 2015 21:49
simple render example
var app = require('express').createServer();
app.get('/', function(req, res){
res.send('hello world');
});
app.get('/:name', function(req, res){
res.send('hello ' + req.param.name);
});
{
"article": {
"headline": "Girls Aloud",
"headlineSpan": 1,
"hideHeadline": false,
"type": "article",
"articleCoverPageWidth": 1,
"copy": "<p>&nbsp;The men who carried out the brutal killing of a soldier in London yesterday are British citizens of Nigerian background who converted to a radical form of Islam, sources have confirmed. But it is understood that the men, who are being treated in separate hospitals while under arrest, are not thought to have links</p>",
"publishDate": "2012-11-19T14:28:11Z",
"style": "Sun_Main_Article",
@simonmcmanus
simonmcmanus / gist:5857607
Created June 25, 2013 10:52
sublime jasmine running that formats the code to make it nice
var sys = require('util');
var exec = require('child_process').exec;
var puts = function puts(error, stdout, stderr) {
var out = stdout.split('\n');
if(out[2].slice(0, 8) === 'Finished') {
console.log(out[3]);
}else {
console.log(stdout);
@simonmcmanus
simonmcmanus / gist:5857608
Created June 25, 2013 10:52
node build system.
{
"cmd": ["/usr/local/bin/node ${file}"],
"selector": "source.js",
"shell": true,
"quiet": true
}
@simonmcmanus
simonmcmanus / gist:6579103
Created September 16, 2013 10:42
Example RSS Atom Feed
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Sun Feed</title>
<link>http://www.thesun.com</link>
<description>big stories</description>
<atom:link href="http://RSS-FEED-URL.com" rel="self" type="application/rss+xml"/>
<item>
@simonmcmanus
simonmcmanus / generate-build-dependencies.js
Created March 20, 2014 15:11
Bundled Dependencies Generator
'use strict';
/**
* Takes a look and the dependencies object and adds each item to the bundled dependencies array.
*/
var fs = require('fs');
var file = __dirname + '/../package.json';
var pkg = require(file);
public class GenerateHash
{
private string key;
private string secret;
public GenerateHash(string key, string secret)
{
this.key = key;
this.secret = secret;
}