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 isNull (value) { | |
return value === null; | |
} | |
// | |
function isUndefined (value, strict) { | |
if (strict === true) return value === undefined; | |
return value == 'undefined'; | |
} | |
// |
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
/** | |
* simple | |
*/ | |
function isDefined (varname) { | |
return window.hasOwnProperty(varname); | |
} | |
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
angular.module('olaferlandsen', []) | |
.directive('ngRut', function() { | |
return function (scope, element, attrs) { | |
element.bind('keypress', function (event) { | |
var value = element.val().replace(/[^0-9k]/ig, ''); | |
if (value.length == 9) event.preventDefault() | |
if ( (event.which >= 48 && event.which <= 57) || event.which == 75) { | |
// reemplazamos todo lo que no sea parte del rut | |
// establecemos el guion medio(-) | |
if (value.length == 7 || value.length == 8) element.val(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
angular.module('olaferlandsen', []) | |
/** | |
* Example of usage: | |
* <input type="element" ng-attrs='{"my-own-attr" : "value", "max": 10, "min":0}'> | |
*/ | |
.directive('ngAttributes', function($injector, $compile) { | |
return function (scope, element, attrs) { | |
var ngAttributes = attrs.ngAttributes; | |
if (typeof ngAttributes== 'string') ngAttributes = ngAttributes.replace(/(^\s+|\s+$)/ig, '') | |
if (ngAttributes.length == 0) return; |
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
/** | |
* Implementation with pure javascript | |
* | |
* Example: | |
* | |
* var someObject = {a: {b: {c: 1}}}; | |
* | |
* objectPathExists(someObject, 'a'); // return true | |
* objectPathExists(someObject, 'a.b'); // return true | |
* objectPathExists(someObject, 'a.b.c'); // return 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
/** | |
* | |
* boolean isEmpty ( value ) | |
* | |
* Example: | |
* | |
* var a = null; | |
* if (isEmpty(a)) { | |
* alert ('empty variable'); | |
* } |
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
/** | |
* | |
*/ | |
$rootScope.storage = function () { | |
/** | |
* Set default API | |
**/ | |
this.API = window.sessionStorage; | |
/** | |
* Set localStorage API |
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
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
NewerOlder