Skip to content

Instantly share code, notes, and snippets.

View kolya182's full-sized avatar
🏠

kolya182

🏠
View GitHub Profile
function renderInventory(inventory) {
for (let i = 0; i < inventory.length; i++) {
for (let j = 0; j < inventory[i].shoes.length; j++) {
return `${inventory[i].name}, ${inventory[i].shoes[j].name}, ${inventory[i].shoes[j].price}`;
}
}
}
let currentInventory = [
{
```javascript
function renderInventory(inventory) {
for (let i = 0; i < inventory.length; i++) {
for (let j = 0; j < inventory[i].shoes.length; j++) {
return `${inventory[i].name}, ${inventory[i].shoes[j].name}, ${inventory[i].shoes[j].price}`;
}
}
}
let currentInventory = [
@kolya182
kolya182 / self-assessment1
Last active June 1, 2017 04:05
Mykola Radchenko
function billTotal(subtotal) {
let tax = subtotal * 0.15;
let tip = subtotal * 0.095;
return subtotal + tax + tip;
}
function range(start, end) {
let resultArr = [];
var generate = function(numRows) {
var result = [1];
if(numRows === 1) {
return [];
}
var container = [1,1];
if (numRows > 1) {
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
todos: ['wake up', 'eat a breakfast', 'try to take over the world'],
value: ''
}
this.handleChange = this.handleChange.bind(this);
@kolya182
kolya182 / HashTable.js
Last active July 29, 2017 16:46 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@kolya182
kolya182 / youtube_channel_achiving.js
Created March 25, 2019 03:26
Node.js script to be run daily for achiving YouTube videos in a specified channel list
const fs = require('fs');
const execSync = require('child_process').execSync;
const CHANNELS_PER_RUN = 8;
function appendLog(string) {
fs.appendFileSync('log.txt', `${new Date().toUTCString()} - ${string}\n`, () => {});
}
let channels = fs.readFileSync('channels.txt', 'utf8');
@kolya182
kolya182 / checkDisk.sh
Created November 27, 2019 01:12 — forked from brimur/checkDisk.sh
Cron script to control
# Name: checkDisk.sh
# Created by: Brimur
# Created: Nov 26th 2019
# This script is used to control Transmission jobs based on available disk space.
#
# This should be run as a cronjob (every minute) on the server/computer running Transmission
#
# If you use a download manager tell it to add jobs as PAUSED
#
# - If disk is nearly full (limit) then stop all jobs