Monday, June 23, 2014
RESTful for Angular / draft
Wednesday, June 11, 2014
How to setup Winston logger by JSON config / Node.js
In other words - how to setup multiple Winston logger by nconf.
Libs
/** | |
* Setup multiple winston logger: | |
* https://github.com/flatiron/winston#working-with-multiple-loggers-in-winston | |
* | |
* by nconf: | |
* https://github.com/flatiron/nconf | |
*/ | |
var winston = require('winston'), | |
nconf = require('nconf'); | |
var config = nconf.argv() | |
.env() | |
.file({ file: 'scripts/config/local_settings.json' }) | |
.file({ file: 'scripts/config/global_settings.json' }); | |
var loggerConfig = config.get('logger'); | |
Object.keys(loggerConfig).forEach(function(key) { | |
winston.loggers.add(key, loggerConfig[key]); | |
}); | |
/** | |
* global_settings.json | |
*/ | |
{ | |
"logger": { | |
"db": { | |
"console": { | |
"level": "info", | |
"colorize": true, | |
"label": "db" | |
} | |
}, | |
"express": { | |
"console": { | |
"level": "info", | |
"colorize": true, | |
"label": "express" | |
} | |
}, | |
"passport": { | |
"console": { | |
"level": "info", | |
"colorize": "true", | |
"label": "passport" | |
} | |
} | |
} | |
} | |
/** | |
* usage | |
*/ | |
var logger = require('winston').loggers.get('express'); | |
logger.info('hello world!'); |
Thursday, May 29, 2014
ORM for Node.js / Draft v0.0.1
Migration tools for NodeJS
You can't find there any brilliant solution as django-south. Anyway, it's hard without them. So there is some please use it at your own risk.
Node-migrate
author: TJ Holowaychuk
https://github.com/visionmedia/node-migrate
It has some bugs and lack of some useful features. On other hand there a lot of pull request but seems that TJ doesn't has abandoned it.
$ npm install migrate
features
up, down, create
Node-db-migrate
https://github.com/kunklejr/node-db-migrate
.... Still don't have experience with it ...
$ npm install db-migrate
features
up, down, create,...
East
Author is Oleg Korobenko. Has adapters to support MongoDB and Sqlite.
$ npm install east -g
features
up, down, create, verbose, db-adapter, fallback on timeout, config file, list of migrations.
Sunday, April 20, 2014
AngularJS Tips / Progress bar on route change
If you need an effect of progressbar-like between different states of an application. Here is quick and dirty solution.
Dependencies
- ui-router - of course you can use ngRoute, but I don't recommend so.
- ngprogress-lite github official page - to get filling how it's works follow to the official page and look on the top of the page;
Ideal
Use something like that between states:
$rootScope.$on('$stateChangeStart', function(){ ngProgressLite. start (); }); $rootScope.$on('$stateChangeSuccess', function(){ ngProgressLite.done(); }); $rootScope.$on('$stateChangeError', function(){ ngProgressLite.done(); });
and fetch all needed dependencies in the resolve section of the states.
Good luck.
Follow the blog to get quick tips for software development.
Sunday, April 13, 2014
Angularjs Tips / Parallax

If you need some popular effects in your angularjs page it is very easy to implement it with library called: angular-parallax Github
Install
Bower
Download
Here is source file: angular-parallax.js put it in your lib foulder
Setup
index.html
<script type='text/javascript' src='path/to/angular-parallax.js'></script>
main.js
angular.module('myApplication', ['angular-parallax']);
main.css
.background { background-attachment: fixed; background-repeat: no-repeat; position: relative; }
using
<div parallax-background parallax-ratio="0.2" class="background"></div>
or
<img parallax parallax-ratio="0.4" src="some/image.jpg" />