Skip to content

Instantly share code, notes, and snippets.

View susanahernandezd's full-sized avatar
🤍

Susana Hernandez susanahernandezd

🤍
View GitHub Profile
@susanahernandezd
susanahernandezd / is_json
Created January 4, 2018 16:24
Know if a string is a json
function isJSON(str) {
try {
return (JSON.parse(str) && !!str);
} catch (e) {
return false;
}
}
<style>
.page-loader {
background: #fff;
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 9998;
//Array splice()
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 0, "Lemon", "Kiwi");
//Preprocess files from a folder
preprocess: {
options: {
context: {
DEBUG: false,
JSVERSION : '<%= globalConfig.versionjs %>'
}
},
html: {
files: [{
//save as a 'devDependencies'
npm install <module> --save-dev
//save as a 'dependencies'
npm install <module> --save
var dt = moment('09/03/2018', "YYYY-MM-DD HH:mm:ss")
//Day of the week
dt.moment().format('d');
//Returns
5
@susanahernandezd
susanahernandezd / array-map
Created March 16, 2018 08:41
Return an array with the square root of all the values in the original array
var numbers = ['uno', "dos", "tres", "cuatro"];
numbers.map(function(val, i) {
console.log(i,val);
}).get();