This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example true backend for angular-login-example | |
*/ | |
var express = require('express'); | |
var http = require('http'); | |
var path = require('path'); | |
var app = express(); | |
// from https://github.com/mrgamer/angular-login-example/blob/master/src/mockhttp.js#L51-L58 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EditorConfig is awesome: http://editorconfig.org/ | |
# Please, read it! | |
# top-most EditorConfig file | |
root = true | |
[*] | |
charset = utf8 | |
end_of_line = lf | |
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* tail -f webserver version, using chunked responses (HTTP 1.1) | |
* slides: http://goo.gl/4VuKS6 | |
*/ | |
var fs = require('fs'), | |
util = require('util'), | |
http = require('http'); | |
http.createServer(function (req, res) { | |
fs.stat(req.url, function (err, stats) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app', ['appMock']) | |
.controller('BodyController', function ($scope, $http) { | |
$scope.games = []; | |
// function bound to the refrsh button | |
$scope.refresh = function () { | |
$http.get('/games').success(function (data, status, headers, config) { | |
$scope.games = data; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('appMock', ['ngMockE2E']) | |
.factory('delayHTTP', function ($q, $timeout) { | |
return { | |
request: function (request) { | |
var delayedResponse = $q.defer(); | |
$timeout(function () { | |
delayedResponse.resolve(request); | |
}, 500); | |
return delayedResponse.promise; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Thanks Raymond Powell | |
* http://stackoverflow.com/a/14640439/1071793 | |
*/ | |
String.prototype.format = function () { | |
var formatted = this, | |
prop, | |
regexp = new RegExp('\\{' + prop + '\\}', 'gi'); | |
for (prop in arguments[0]) { | |
formatted = formatted.replace(regexp, arguments[0][prop]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[push] | |
default = matching | |
[color] | |
diff = true | |
ui = true | |
branch = true | |
[color "branch"] | |
remote = white reverse | |
[color "diff"] | |
meta = yellow bold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name *.test; | |
gzip on; | |
location / { | |
#proxy_set_header Host api.github.com; | |
proxy_pass http://localhost:1337/; | |
proxy_buffering off; | |
proxy_http_version 1.1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (request, response) { | |
// response.setHeader('Content-Type', 'application/json; charset=UTF-8'); | |
// response.setHeader('Transfer-Encoding', 'chunked'); | |
var html = | |
'<!DOCTYPE html>' + | |
'<html lang="en">' + | |
'<head>' + |