Skip to content

Instantly share code, notes, and snippets.

View Anna-Myzukina's full-sized avatar
💭
if you NEVER try } YOU`LL never KNOW

Anna Muzykina Anna-Myzukina

💭
if you NEVER try } YOU`LL never KNOW
View GitHub Profile
var _ = require("lodash");
var worker = function(users) {
return _.where(users, {active: true});
};
module.exports = worker;
@Anna-Myzukina
Anna-Myzukina / 010.js
Last active August 28, 2018 17:52
planetproto
// -> Create an object called 'robot' using an object literal
// -> robot should have a property 'smart' with value true
var robot = {
smart: true
};
// -> Claim the result robot.smart
claim(robot.smart, true);
// ------------------------------------------------
@Anna-Myzukina
Anna-Myzukina / 1-IDENTITY.js
Last active September 17, 2018 15:47
Cyrrying in js
function identity(args) {
return args;
}
module.exports = identity;
@Anna-Myzukina
Anna-Myzukina / exercise1.js
Last active August 31, 2018 09:18
Promise It Won’t Hurt
//Using setTimeout, print the string 'TIMED OUT!' after 300ms.
setTimeout(() => {
console.log('TIMED OUT!')
}, 300)
@Anna-Myzukina
Anna-Myzukina / 2-balanceManager.js
Last active September 24, 2018 21:23
js-best-practices
//Exercise 2 Separation of Concerns 1
//Separation of Concerns Part 1
/*take the 4 methods and any variables that relate to
balance management and move them to balanceManager.js. Then, back in
vendingMachine.js, change the method of calling those functions from this
to our new balanceManager
*/
var balance = 0;
@Anna-Myzukina
Anna-Myzukina / chain.js
Last active September 3, 2018 12:02
Lolodash
//Exercise 5 [_.chain(value)]
/*We have a list of words that we want to modify.
['Test', 'Hello', 'World', 'Node', 'JavaScript']
We want to modify each word so that they are all appended with the word Chained, converted to uppercase, and sorted by alphabetical order. The result should look like this:
['HELLOCHAINED', 'JAVASCRIPTCHAINED', 'NODECHAINED', 'TESTCHAINED', 'WORLDCHAINED']
*/
@Anna-Myzukina
Anna-Myzukina / alteration.js
Last active September 4, 2018 05:44
regex-adventure
//Exercise 11
/*Export a function that takes a string argument and returns whether the string starts with `cat`, `dog`, or `robot` followed by a number to the end of the string
*/
module.exports = function (str) {
return /^(cat|dog|robot)\d+$/.test(str);
}
@Anna-Myzukina
Anna-Myzukina / 1-helloWorld.js
Last active September 15, 2018 15:40
expressworks
/*Exercise 1
Create an Express.js app that outputs "Hello World!" when somebody goes to /home.The port number will be provided to you by expressworks as the first argument ofthe application, i.e., process.argv[2]
*/
var express = require('express')
var app = express()
app.get('/home', function(req, res) {
res.end('Hello World!')
})
app.listen(process.argv[2])
@Anna-Myzukina
Anna-Myzukina / babelSetup.js
Created September 4, 2018 20:19
tower-of-babel
// Exercise 1
/**
Create a javascript program that takes the the first command-line argument and
outputs it right after a "Hello " String using ES6 template strings
*/
var arg = process.argv[2];
console.log(`Hello ${arg}`);
@Anna-Myzukina
Anna-Myzukina / .npmrc
Last active September 10, 2018 04:49
how-to-npm
registry = http://localhost:15443/
userconfig = /home/anna/.config/how-to-npm/npmrc