This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
#!/bin/bash | |
echo time sh -c "dd if=/dev/zero of=ddfile bs=8k count=1000000 && sync" | |
echo dd if=/dec/zero of=ddfile2 bs=8K count=500000 | |
echo time dd if=ddfile of=/dev/null bs=8k |
This file contains hidden or 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
// credits to: http://stackoverflow.com/questions/3199588/fastest-way-to-convert-javascript-nodelist-to-array | |
function toArray (nl) { | |
var l=nl.length, arr = new Array(l); | |
while(l--){arr[l]=nl[l];} | |
return arr; | |
} |
This file contains hidden or 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
description "<description here>" | |
author "<[email protected]>" | |
start on filesystem or runlevel [2345] | |
stop on shutdown | |
# Automatically Respawn: | |
respawn | |
respawn limit 3 5 |
This file contains hidden or 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
--- | |
- name: trying to create a directory that requires sudo | |
file: | |
state=directory | |
path=/helloworld | |
# sudo should not be required there! | |
- name: removing it | |
file: | |
state=absent |