Skip to content

Instantly share code, notes, and snippets.

View vladimir-ivanov's full-sized avatar

vladimir ivanov vladimir-ivanov

View GitHub Profile
@vladimir-ivanov
vladimir-ivanov / gist:4066520
Created November 13, 2012 15:54
JSCover example
/*
* STEPS
* 1. Download JSCover from https://github.com/tntim96/JSCover/downloads
* 2. Download htmlunit bin rather than src version from http://sourceforge.net/projects/htmlunit/files/htmlunit/
*/
// start JSCover-all.jar
java -jar target/dist/JSCover-all.jar -ws --document-root=/www/dsa/project/web --no-instrument=js/test --no-instrument=js/lib/vendor --report-dir=target
/**
* Example to use in the brows
@vladimir-ivanov
vladimir-ivanov / Blur.js
Created May 16, 2013 16:18
ngBlur - to work with function passed as argument only
var BlurDirective = function () {
return {
restrict: 'A',
link: function (scope, elm, attrs) {
elm.bind('blur', function () {
console.log(attrs);
var blurArgs = attrs.blur,
functionName = blurArgs.match(/([^\(]*)/),
var BlurDirective = function () {
return {
restrict: 'A',
link: function (scope, elm, attrs) {
elm.bind('blur', function () {
console.log(attrs);
var blurArgs = attrs.blur,
functionName = blurArgs.match(/([^\(]*)/),
@vladimir-ivanov
vladimir-ivanov / Blur.js
Created May 17, 2013 08:42
Blur directive in angular js style ;-)
var BlurDirective = function ($parse) {
return {
restrict: 'A',
link: function (scope, elm, attrs) {
var callback = $parse(attrs.blur);
elm.bind('blur', function (event) {
scope.$apply(function () {
callback(scope, {$event: event});
@vladimir-ivanov
vladimir-ivanov / Tooltip.js
Created May 17, 2013 08:46
html tooltip directive with html inside the tooltip - depends on jquery ui tooltiip
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true, noarg:true,
noempty:true, nonew:true, undef:true, unused:true, strict:true, browser:true */
/*globals
$: false,
_: false
*/
// needs to be made generic at some point
var ToolTipDirective = function ($compile) {
@vladimir-ivanov
vladimir-ivanov / Truncate.js
Created May 17, 2013 08:47
angular js truncate filter
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true, noarg:true,
noempty:true, nonew:true, undef:true, unused:true, strict:true, browser:true */
/*globals
String: false;
*/
var TruncateFilter = function () {
return function (text, length, end) {
@vladimir-ivanov
vladimir-ivanov / spring-mvc-configuration.xml
Created May 28, 2013 13:22
java spring 3 json and tiles view resolvers
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
@vladimir-ivanov
vladimir-ivanov / pom.xml
Created June 16, 2013 11:46
Maven 3 integration of testacular unit tests
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
@vladimir-ivanov
vladimir-ivanov / Timer.js
Created June 18, 2013 11:23
AngularJs timer with throttle plus valid jshinting
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true, noarg:true,
noempty:true, nonew:true, undef:true, unused:true, strict:true, browser:true, camelcase:false, unused: false */
/*globals
$: false,
app: false,
angular: false,
factory: false,
UrlHelper: false,
showFeedUrl: false,
@vladimir-ivanov
vladimir-ivanov / BrowserStorage.js
Created June 18, 2013 11:25
AngularJs browser session storage wrapper
/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true, noarg:true,
noempty:true, nonew:true, undef:true, unused:true, strict:true, browser:true, camelcase:false */
/*globals
_: false
*/
/*exported
BrowserStorageFactory
*/