Skip to content

Instantly share code, notes, and snippets.

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@rosputniy
rosputniy / ssh.md
Created November 27, 2019 12:25 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@rosputniy
rosputniy / filterArray.js
Created November 7, 2019 11:40 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects by custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@rosputniy
rosputniy / VideoPlayer.html
Created September 18, 2018 19:09 — forked from jaydenseric/VideoPlayer.html
A simple HTML5 video player.
<figure class="video-player">
<video preload="none" width="1280" height="720" poster="video.jpg">
<source src="video.webm" type="video/webm" />
<source src="video.mp4" type="video/mp4" />
</video>
<button class="play-toggle">Toggle play</button>
<button class="mute-toggle">Toggle mute</button>
</figure>
<script>
// Initialize video player
function episodeParser({
id,
title,
description = 'No summary',
optionalField,
anotherOptionalField
}) {
return {
guid: id,
title,
/*
* Wraps axios and provides
* more convenient post method
* calls with payload data
*/
export function post(uri, data) {
return axios.post(uri, data, {
headers: getHeaders(),
withCredentials: true
})
/*
* Returns default headers list
* which will be used with every request.
*/
function getHeaders(multipart = false) {
let defaultHeaders = BASE_HEADERS
if (multipart) {
defaultHeaders = {}
}
@rosputniy
rosputniy / EventBus.js
Created September 14, 2018 17:27 — forked from PierfrancescoSoffritti/eventBus.js
A simple implementation of an event bus in Javascript
function EventBus() {
const eventCallbacksPairs = [];
this.subscribe = function( eventType, callback ) {
const eventCallbacksPair = findEventCallbacksPair(eventType);
if(eventCallbacksPair)
eventCallbacksPair.callbacks.push(callback);
else
eventCallbacksPairs.push( new EventCallbacksPair(eventType, callback) );
@mixin spacing($type: 'xl', $property: 'margin-top') {
#{$property}: map-get($margins, $type);
#{$property}: var(--margin-#{$type});
}
:root {
--spacing-s: 1.5rem;
--spacing-m: 5rem;
--spacing-l: 10rem;
--spacing-xl: 10rem;
@rosputniy
rosputniy / modifiers.scss
Created March 15, 2018 16:34 — forked from sarahdayan/modifiers.scss
Sass Modifiers Mixin
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// Sass modifiers mixin by Sarah Dayan
// Generate All Your Utility Classes with Sass Maps: frontstuff.io/generate-all-your-utility-classes-with-sass-maps
// http://frontstuff.io
// https://github.com/sarahdayan