Skip to content

Instantly share code, notes, and snippets.

View JBreit's full-sized avatar

Jason Breitigan JBreit

  • Inner Mind Co.
  • Lancaster, PA
View GitHub Profile
@JBreit
JBreit / app.js
Last active January 14, 2017 15:27
Raven NodeJS Server
var app = function (request, response) {
'use strict';
response.write('test');
request.pipe(response);
};
module.exports = app;
var express = require('express'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
favicon = require('serve-favicon'),
path = require('path'),
logger = require('./../utils/logger'),
methodOverride = require('method-override'),
morgan = require('morgan'),
session = require('express-session'),
db = require('./config/db'),
/*globals define*/
(function (global, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
@JBreit
JBreit / config.js
Created March 14, 2017 00:42
Part of an experimental Node.js configuration file
var normalizePort = require('./../../utils').normalizePort,
_defaults = [
/*"NODE_ENV",*/
"HOST",
"PORT"
];
_defaults.forEach(function (name) {
var fs = require('fs');
exports.GET = function (path, respond) {
'use strict';
fs.stat(path, function (error, stats) {
if (error && error.code === "ENOENT") {
respond(404, "File not found");
} else if (error) {
respond(500, error.toString());
var http = require('http'),
ecstatic = require("ecstatic"),
fileServer = ecstatic({root: "./public"}),
config = require('./options'),
router = require('./routes');
var normalizePort = function (val) {
'use strict';
var _port = parseInt(val, 10);
@JBreit
JBreit / index.js
Last active April 2, 2017 23:11
Service Worker Experiment
(function (window) {
'use strict';
// Uncomment after getting https server to work on windows or finally have a Linux environment
// if ((!location.port || location.port === "8080") && location.protocol !== 'https:') {
// location.protocol = 'https:';
// }
/*console.log('location protocol: %s', location.protocol);
console.log('location port: %s', location.port);*/
/*global ReadableStream*/
(function () {
'use strict';
var interval;
var stream = new ReadableStream({
start: function (controller) {
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
/*global angular $*/
(function () {
'use strict';
angular.module('innermind.controllers', [])
.controller('MainCtrl', [
'$scope',
'$state',
'$http',