Skip to content

Instantly share code, notes, and snippets.

View adnanrahic's full-sized avatar
🥑
Channeling my inner Avocado at @kubeshop

Adnan Rahić adnanrahic

🥑
Channeling my inner Avocado at @kubeshop
View GitHub Profile
var moveZeros = function (arr) {
// move zeroes to end
}
console.log(moveZeros([0,1,0,2,0,1,0,1,0,3,0,1]));
console.log(moveZeros([0,0,null,1,0,'a',2,'e',0,1,0,false,1,{},0,3,[],'b',0,1]));
// Service
module.exports = {
createUser: createUser
};
function createUser(req, res, next) {
return User.findOne({neki id})
.then(user => {
if (user.exists) return res.status(500).send('zajebo si');
})
function generateSections(content) {
var sections = [];
var section = {};
var subsection = {};
var contentSplit = content.split('<h1>');
for(index in contentSplit) {
if (contentSplit[index].indexOf('</h1>') !== -1) {
section = {};
section.title = contentSplit[index].substring(0, contentSplit[index].indexOf('</h1>'));
contentSecondSplit = contentSplit[index].split('<h2>');
function addTwoNumbers(x, y) {
return x + y;
}
console.log(addTwoNumbers(5, 1));
function addTwoNumbers(x, y) {
return x + y;
}
function testAddTwoNumbers() {
var x = 5;
var y = 1;
var sum1 = x + y;
var sum2 = addTwoNumbers(x, y);
function addTwoNumbers(x, y) {
return x + y;
}
function testAddTwoNumbers() {
// 1. ARRANGE
var x = 5;
var y = 1;
var sum1 = x + y;
var assert = {
equal: function(firstValue, secondValue) {
if (firstValue != secondValue)
throw new Error('Assert failed, ' + firstValue + ' is not equal to ' + secondValue + '.');
}
};
function addTwoNumbers(x, y) {
return x + y;
}
var assert = require('assert');
function addTwoNumbers(x, y) {
return x + y;
}
function testAddTwoNumbers() {
var x = 5;
var y = 1;
var sum1 = x + y;
function addTwoNumbers(x, y) {
return x + y;
}
module.exports = addTwoNumbers;