Skip to content

Instantly share code, notes, and snippets.

View jacksoncharles's full-sized avatar
🎯
Focusing

Charles Jackson jacksoncharles

🎯
Focusing
View GitHub Profile
@jacksoncharles
jacksoncharles / gist:f131eed72cb4db88f135f552ad22c386
Created May 12, 2016 09:12
docker-compose file currently used by Charles for loading SSO and OMG with service discovery and gateway.
productsapi:
build: ./productsapi
dns:
- 172.16.4.2
- 172.16.4.13
- 10.49.32.4
ports:
- "80"
volumes:
- ./productsapi:/var/www
@jacksoncharles
jacksoncharles / gist:960761ea509bcd4cbaae
Created March 25, 2016 08:09
docker-compose config file
productsapi:
build: ./productsapi
dns:
- 172.16.4.2
- 172.16.4.13
- 10.49.32.4
ports:
- "8080:80"
volumes:
- ./productsapi:/var/www
@jacksoncharles
jacksoncharles / gist:6485427
Created September 8, 2013 15:05
Check for a valid wikipedia URL such as http://en.wikipedia.org/wiki/Charles_Babbage
VALID_WIKIPEDIA_REGEX = /\Ahttp:\/\/en.wikipedia.org\/wiki\/.{1,}\z/
@jacksoncharles
jacksoncharles / server.js
Created September 7, 2013 17:55
node.js : handling url parameters
// Include http module,
var http = require("http"),
// And url module, which is very helpful in parsing request parameters.
url = require("url");
// Create the server.
http.createServer(function (request, response) {
// Attach listener on end event.
request.on('end', function () {
// Parse the request for arguments and store them in _get variable.
@jacksoncharles
jacksoncharles / server.js
Created September 7, 2013 16:58
node.js hello world webserer
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
@jacksoncharles
jacksoncharles / gist:6424851
Last active December 22, 2015 05:38
Simple example courtesy of Steven Robinson. You can just return a seperate object containing public mehods, but this way is better as then all functions are accessible within the outer function
<script type="text/javascript">
var COUNTER = (function () {
var counter = {},
num = 0,
increment = function () {
console.log(num += 1);
@jacksoncharles
jacksoncharles / gist:6424691
Last active December 22, 2015 05:29
Courtesy Steven Robinson, simple example with inline docs. The outer function is the closure, and even after it returns, everything within it is still available in memory.
<script type="text/javascript">
// define a var to be used as an app namespace
var APP = (function () {
// define an object which will be returned, single 'var' pattern
var app = {},
// define some private 'functions' and vars if necessary
priv1 = function () {