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
docs/ | |
reports/ | |
# Mac OS X | |
.DS_Store | |
# VS Code | |
jsconfig.json | |
# Node.js |
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
#add 'node_modules' to .gitignore file | |
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin master |
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
//Take 2 strings s1 and s2 including only letters from ato z. Return a new sorted string, the longest possible, containing distinct letters, - each taken only once - coming from s1 or s2. | |
/* | |
Examples: | |
a = "xyaabbbccccdefww" | |
b = "xxxxyyyyabklmopq" | |
longest(a, b) -> "abcdefklmopqwxy" | |
a = "abcdefghijklmnopqrstuvwxyz" | |
longest(a, a) -> "abcdefghijklmnopqrstuvwxyz" |
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
create table temp | |
( | |
date datetime, | |
category varchar(3), | |
amount money | |
) | |
insert into temp values ('1/1/2012', 'ABC', 1000.00) | |
insert into temp values ('2/1/2012', 'DEF', 500.00) | |
insert into temp values ('2/1/2012', 'GHI', 800.00) |
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 theString = "This is a string."; | |
console.log(theString.split("i").length - 1); | |
//Example: Count amount of vowels in string | |
function amoutVowel(wort){ | |
var vowels = ["a","e","i","o","u","ä","ö","ü","E","O","A","I","U"]; | |
var countVowel = 0; | |
for(var i = 0; i < vowels.length; i++) { | |
if (wort.indexOf(vowels[i]) !== -1) { |
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
'use strict'; | |
//New in ES6 | |
class Animal { | |
constructor(voice){ | |
this.voice = voice || "Grunt" | |
} | |
speak() { | |
console.log(this.voice) | |
} |
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
'use strict'; | |
function Animal(voice) { | |
this.voice = voice || "grunt" | |
} | |
Animal.prototype.speak = function() { | |
display(this.voice); | |
} |
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
'use strict'; | |
function Cat(name, color) { | |
this.name = name | |
this.color = color | |
//An empty object is created. After this, JS updates the function's PROTOTYPE property to point to this object (Cat object) | |
} | |
Cat.prototype.age = 5; //We haven't even created a Cat object, but PROTOTYPE property created behind the scenes..., then we add the age to the Cat's protype. |
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 fs = require('fs'), | |
gm = require('gm').subClass({imageMagick: true});; | |
var IMAGE_DIR = __dirname +'/images/', | |
SAVE_DIR = __dirname +'/imagesResize/'; | |
var imageList = ['1.jpg', '2.jpg', '3.jpg']; | |
var resize_keep_ratio = function(name) { | |
console.log(IMAGE_DIR+ name); |
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 getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min); | |
} | |
function getRandomBetweenZeroAndOne() { | |
return Math.round(Math.random()); |