Skip to content

Instantly share code, notes, and snippets.

👽
Yep, that's pretty good

web.ivan kv9991

👽
Yep, that's pretty good
Block or report user

Report or block kv9991

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kv9991
kv9991 / git-clone.sh
Created Mar 7, 2019
Clone with specific SSH key
View git-clone.sh
ssh-agent bash -c 'ssh-add [path-to-key]; git clone [ssh-link-to-repository]'
@kv9991
kv9991 / mongo.js
Last active Jan 20, 2019
Get tasks with user result
View mongo.js
db.getCollection('tasks').aggregate([{
$lookup: {
from: "taskresults",
localField: "_id",
foreignField: "task",
as: "taskResult"
}
}, {
$match: {
"taskResult.user": {
@kv9991
kv9991 / min-width.js
Created Dec 7, 2018
Viewport with content min-width
View min-width.js
if (screen.width < 450){
var viewport = document.querySelector("meta[name=viewport]");
viewport.parentNode.removeChild(viewport);
var newViewport = document.createElement("meta");
newViewport.setAttribute("name", "viewport");
newViewport.setAttribute("content", "width=450");
document.head.appendChild(newViewport);
}
@kv9991
kv9991 / phantom.js
Created Nov 9, 2018
Phantom.js taking screen
View phantom.js
var child_process, createScreenshot, phantom, url;
phantom = require('phantom'); // npm install phantom
child_process = require('child_process');
url = "https://google.com";
createScreenshot = function(page, filename) {
return page.render(filename, function() {
@kv9991
kv9991 / buttonoverride.css
Created Oct 31, 2018
Button overriding basic styles
View buttonoverride.css
button {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
box-shadow: none;
outline: inherit;
}
@kv9991
kv9991 / getUserFeed.js
Created Sep 14, 2018
Find user feed posts
View getUserFeed.js
const yesterday = Date.now() - 1000*60*60*24;
const getUserFeed = (userId, params) => User.findById(userId)
.populate(USER_ENTRY_SUBSCRIPTIONS)
.then(user =>
Post.find({
[POST_ENTRY_CREATED]: { $gt: yesterday },
[`${POST_ENTRY_AUTHOR}.${ENTITY_ENTRY_ITEM}`]: { $in: [
...user[USER_ENTRY_SUBSCRIPTIONS][USER_SUBSCRIPTIONS_ENTRY_USERS],
View file.js
var Parent = mongoose.model('Parent', parentSchema);
var parent = new Parent({ children: [{ name: 'Matt' }, { name: 'Sarah' }] })
parent.children[0].name = 'Matthew';
// `parent.children[0].save()` is a no-op, it triggers middleware but
// does **not** actually save the subdocument. You need to save the parent
// doc.
parent.save(callback);
@kv9991
kv9991 / README.md
Last active Jul 20, 2018
React Exam
View README.md

Вопросы

Вопрос 1

Жизненный цикл React компонента. Все различия между функциональными компонентами и компонентами основанными на React.Component.
Особенности работы setState

Вопрос 2

Как работает JSX. Описать работу компилятора
@kv9991
kv9991 / file.js
Created Jul 19, 2018
Key-value tables pattern
View file.js
import {
COURSE_ENTRY_STATUS_DRAFT,
COURSE_ENTRY_STATUS_PUBLISHED
} from "@consts/course";
/**
* Array of available statuses
*/
const availableStatuses = [
@kv9991
kv9991 / README.md
Last active Jul 7, 2018
Javascript Exam
View README.md

Вопросы

Общие вопросы JS

Вопрос 1

Массивы в JS. Основные методы работы с массивами, способы создания массивов, тонкости работы некоторых методов таких как Push, Pop итд

Вопрос 2

Что такое замыкания в JS. Как работают области видимости. Как работает ключевое слово This

Вопрос 3

You can’t perform that action at this time.