Skip to content

Instantly share code, notes, and snippets.

View capaj's full-sized avatar
🏠
Always working-be it from home or elsewhere

Jiri Spac capaj

🏠
Always working-be it from home or elsewhere
View GitHub Profile
function subscribeAllMouseEvents(element) {
var evNames = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'mouseover', 'mouseout', 'mousewheel' ];
evNames.forEach(function (evName) {
element.addEventListener(evName, function(e) {
console.log(e);
});
});
}
@capaj
capaj / pokus
Last active August 29, 2015 13:57
Novela koučení
Zpráva z nově provedeného výzkumu agentury Ipsos ve spolupráci se studenty Fakulty
sociálních věd Univerzity Karlovy říká, že v Česku vzrostl počet lidí, kteří jsou pro zákaz
kouření v restauracích. Pro úplný zákaz kouření by bylo 78 % Čechů, což je poměrně
vysoký počet lidí. K nekuřákům se totiž přidávají pomalu ale jistě už i kuřáci.
Přitom v roce 2007 podporovalo zákaz jen 13 procent kuřáků, dnes s nevím
@capaj
capaj / grunt spawn with piping to console
Created May 4, 2014 18:52
just simple spawn process example with grunt.js
var cp = require('child_process');
var isWin = /^win/.test(process.platform);
var cloneProcess;
if (isWin) {
cloneProcess = cp.spawn('grunt.cmd', []);
}else{
cloneProcess = cp.spawn('grunt');
}
@capaj
capaj / protractor-screen-on-fail.js
Created May 8, 2014 11:31
protractor will take screenshot on any jasmine spec fail
var fs = require('fs');
var originalAddMatcherResult = jasmine.Spec.prototype.addMatcherResult;
jasmine.Spec.prototype.addMatcherResult = function() {
if (!arguments[0].passed()) {
browser.takeScreenshot().then(function(png) {
var stream = fs.createWriteStream("./screenshot.png");
stream.write(new Buffer(png, 'base64'));
stream.end();
});
@capaj
capaj / index_no_nsp.html
Last active August 29, 2015 14:02
socket.io namespace problem 1.0.1-1.0.3
<html>
<body>
<h1>no namespace</h1>
</body>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io('/');
socket.emit('my other event', { my: 'data1212' });
</script>
</html>
@capaj
capaj / npm debug log
Created July 29, 2014 22:26
npm fetching fails
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'update',
1 verbose cli 'grunt-contrib-concat' ]
2 info using npm@1.4.14
3 info using node@v0.10.29
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose url raw grunt-contrib-concat
6 verbose url resolving [ 'https://registry.npmjs.org/', './grunt-contrib-concat' ]
@capaj
capaj / o_deepObserve.html
Created August 22, 2014 10:36
just puny exercies trying to make deepObserve happen
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
// Let's say we have a model with data
var propObj = {};
@capaj
capaj / runSequentially
Created August 28, 2014 06:45
runSequentially
var runSequentially = function(arr, onEach){
var res = [];
var step = function() {
return onEach(arr[0]).then(function(resolved) {
arr.splice(0,1);
resolved.push(res);
if (arr.length > 0) {
return step();
} else {
return res;
@capaj
capaj / index.html
Last active August 29, 2015 14:11
minimal node.js, angular and github auth example
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<base href="/">
<title>app</title>
</head>
<body>
<button ng-click="loginGH()">Login</button>
@capaj
capaj / index.html
Created January 21, 2015 22:32
non working angular-material inputs
<!DOCTYPE html>
<html>
<head>
<!-- Angulars Material CSS now available via Google CDN; version 0.6 used here -->
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/angular_material/0.6.1/angular-material.min.css">
<!-- Angular Material Dependencies -->
<script src="//cdn.jsdelivr.net/hammerjs/2.0.4/hammer.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>