Skip to content

Instantly share code, notes, and snippets.

View frostbytten's full-sized avatar

Christopher Villalobos frostbytten

View GitHub Profile
@frostbytten
frostbytten / pom.xml
Created January 25, 2012 21:31
Initial CAS Overlay with jetty-maven-plugin
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
<modelVersion>4.0.0</modelVersion>
<groupId>{your groupId here}</groupId>
<artifactId>local-cas</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
@frostbytten
frostbytten / server.js
Created June 12, 2011 11:04
Connect-Auth Facebook Example
// Example taken from https://github.com/ciaranj/connect-auth/issues/45
var fbId= "xxxxxxxxxxxxx";
var fbSecret= "xxxxxxxxxxxxxx";
var fbCallbackAddress= "http://localhost:3000/auth/facebook_callback"
var cookieSecret = "node"; // enter a random hash for security
var express= require('express');
var auth = require('connect-auth')
@frostbytten
frostbytten / gist:983546
Created May 20, 2011 18:59
Closure JS try-catch
app.error(function( err, req, res, next ){
console.log(err);
if( ! ( err instanceof SoftError ) ) {
console.log(err.stack);
res.render('errors.ejs', {error: err.message || err.name });
}
});
app.all('/errr', function( req, res ){
try {
@frostbytten
frostbytten / gist:977375
Created May 17, 2011 20:54
Weird Express Middleware issue
var loadCommon = function( req, res, next ) {
var user = req.getAuthDetails().user;
req.age = req.session.age || 0;
req.user = (user === undefined ? false : (user.username || user.email || false));
if(!config.devmode) {
req.authprovider = req.session.authprovider; //LIVE
} else {
req.user = "removeme"; // DEV MODE
req.authprovider = 'twitter'; //DEV MODE
}
Test Gist