Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
## HTML | |
<div class="row"> | |
<div class="col-sm-12"> | |
<ul class="list-inline rating-list" | |
*ngFor="let star of stars" style="display: inline-block" > | |
<li (click)="countStar(star)" | |
[ngClass]="{'selected': (star <= selectedValue)}"> | |
<i class="fa fa-star"></i> | |
</li> | |
</ul> |
This file contains hidden or 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
//https://www.sitepoint.com/sort-an-array-of-objects-in-javascript/ | |
compare(a, b) { | |
const genreA = a.servicebillingfact.rec_version_num; | |
const genreB = b.servicebillingfact.rec_version_num; | |
let comparison = 0; | |
if (genreA < genreB) { | |
comparison = 1; | |
} else if (genreA > genreB) { | |
comparison = -1; |
This file contains hidden or 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
// https://scotch.io/bar-talk/copying-objects-in-javascript | |
private clone(obj) { | |
let copy; | |
// Handle the 3 simple types, and null or undefined | |
if (null == obj || "object" != typeof obj) return obj; | |
// Handle Date | |
if (obj instanceof Date) { | |
copy = new Date(); |
This file contains hidden or 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
// Método Array#forEach | |
var miArray = [ 2, 4, 6, 8, 10 ]; | |
miArray.forEach( function(valor, indice, array) { | |
console.log("En el índice " + indice + " hay este valor: " + valor); | |
}); | |
// Método Object#keys combinado con Método Array#forEach | |
var obj = { | |
first: "John", | |
last: "Doe" |
This file contains hidden or 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
questions_template = []; | |
getQuestionsTemplate() { | |
let template = require('./datamodel_questions_template.json'); | |
for (var key in template) { | |
if (!template.hasOwnProperty(key)) continue; | |
if (key === "questions") { | |
var obj = template[key]; | |
for (var prop in obj) { |
This file contains hidden or 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
// non destructive filter > noJohn = John removed, but someArray will not change | |
let someArray = getArray(); | |
let noJohn = someArray.filter( el => el.name !== "John" ); | |
// destructive splice /w findIndex | |
let someArray3 = getArray(); | |
someArray3.splice(someArray3.findIndex(v => v.name === "John"), 1); | |
function getArray() { | |
return [ {name: "Kristian", lines: "2,5,10"}, |
This file contains hidden or 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
convertTextToUrl(text) { | |
let replacedText = ''; | |
if (text != '') { | |
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; | |
var text1 = text.replace(exp, "<a href='$1' target='_blank'>$1</a>"); | |
var exp2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim; | |
const node = this.myRefLink.current; | |
if (node != null) { | |
node.innerHTML = text1.replace(exp2, '$1<a href="http://$2" target="_blank">$2</a>'); | |
} |
This file contains hidden or 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
.dont-break-out { | |
/* These are technically the same, but use both */ | |
overflow-wrap: break-word; | |
word-wrap: break-word; | |
-ms-word-break: break-all; | |
/* This is the dangerous one in WebKit, as it breaks things wherever */ | |
word-break: break-all; | |
/* Instead use this non-standard one: */ | |
word-break: break-word; |
This file contains hidden or 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 order(arraylist){ | |
return arraylist.sort(this.sortThings); | |
} | |
function sortThings(a, b) { | |
if (a.NOMBRE > b.NOMBRE) { | |
return 1; | |
} else if (a.NOMBRE < b.NOMBRE) { | |
return -1; | |
} else if (a.NOMBRE === b.NOMBRE) { |