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
function calculate(cols, nb){ | |
_this_.cols = cols; | |
_this_.rows = Math.ceil(nb/cols); | |
_this_.rest = nb % cols; | |
_this_.boxDim = _this_.width/cols - 2*_this_.border; | |
if(_this_.boxDim <= 1){ | |
debug.exec('warn', 'Dimensions of the boxes are too small to be seen'); |
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
#append this to your .bashrc file in your home | |
#git auto-completion | |
source ~/.git-completion.sh | |
#git prompt | |
source ~/.git-prompt.sh | |
GIT_PS1_SHOWCOLORHINTS=true | |
GIT_PS1_SHOWSTASHSTATE=true | |
GIT_PS1_SHOWUNTRACKEDFILES=true | |
GIT_PS1_SHOWUPSTREAM="auto" |
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
/* | |
data = { | |
ctrl_path: | |
{ message: 'Validator "required" failed for path ctrl_path with value ``', | |
name: 'ValidatorError', | |
path: 'ctrl_path', | |
type: 'required', | |
value: '' }, |
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 book = { | |
title : 'brave new world', | |
author : 'aldous huxley', | |
rating : '2' | |
}; | |
var params = { | |
title : 'lmkwxlkc', |
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
//matches type like kqsjdlqj@kjdfhdjhf (with @ in the middle) | |
if(/^[^@]+@[^@]+$/.test(type) === true){ | |
} |
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 : | |
* var a = [2,7,9]; | |
* binaryInsert(8, a); | |
* | |
* It will output a = [2,7,8,9] | |
* | |
*/ | |
function binaryInsert(value, array, startVal, endVal){ |
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 range = document.createRange();//Create a range (a range is a like the selection but invisible) | |
range.selectNodeContents(this.target);//Select the entire contents of the element with the range | |
range.setEnd(this.target.firstChild, pos); | |
range.collapse();//collapse the range to the end point. false means collapse to end rather than the start | |
selection = window.getSelection();//get the selection object (allows you to change selection) | |
selection.removeAllRanges();//remove any selections already made | |
selection.addRange(range); |
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
(function(angular){ | |
angular.module('folio.components.project.thumbUpload', []) | |
.factory('ThumbUpload', ['$q', '$http', '$log', ThumbUploadProvider]); | |
function ThumbUploadProvider($q, $http, $log){ | |
function ThumbUploadService(){ | |
this.upload = function(file, filename){ | |
var deferred = $q.defer(); | |
var fd = new FormData(); |
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
(function(angular){ | |
angular.module('app.lib.http.interceptorRequestFormatter', ['nvision.lib.xmlRequestFormatter']) | |
.config(['$httpProvider',function($httpProvider) { | |
$httpProvider.interceptors.push('InterceptorRequestFormatter'); | |
}]) | |
.factory('InterceptorRequestFormatter', ['XmlRequestFormatter', InterceptorRequestFormatterProvider]); | |
function InterceptorRequestFormatterProvider(XmlRequestFormatter){ | |
// Formats the request 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
/* | |
Usage: | |
$onceRendered(function(){ // do your thing}); | |
*/ | |
(function(angular){ | |
'use strict'; | |
angular.module('app.lib.onceRendered', []) | |
.factory('$onceRendered', ['$U', '$http', '$timeout', ServiceFactory]); | |
function ServiceFactory($U, $http, $timeout){ |