Skip to content

Instantly share code, notes, and snippets.

View picpoint's full-sized avatar
:octocat:
<html> .less {js} <?php?> "mysql"

rmtar picpoint

:octocat:
<html> .less {js} <?php?> "mysql"
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<div class="slider">
@picpoint
picpoint / app.js
Created January 27, 2020 18:57
add classes to commonjs system
const calc = require('./calculator.js');
const myCalculator = new calc.myCalc();
console.log(myCalculator.summ(7, 8));
console.log(myCalculator.diff(4, 10));
console.log(myCalculator.divv(4, 5));
console.log(myCalculator.mult(4, 9));
@picpoint
picpoint / fileReader.js
Created January 15, 2020 17:07
read and output file on page
let inFile = document.querySelector('#inFile');
let outFile = document.querySelector('#outFile');
let fileReader = new FileReader();
fileReader.addEventListener('load', () => {
outFile.src = fileReader.result;
});
@picpoint
picpoint / index.js
Created August 28, 2019 13:59
LOFT ДЗ 3
/* ДЗ 3 - работа с массивами и объеектами */
/*
Задача 1:
Напишите аналог встроенного метода forEach для работы с массивами
*/
function forEach(array, fn) {
for (let i = 0; i < array.length; i++) {
fn(array[i], i, array);
}
@picpoint
picpoint / index.js
Created August 18, 2019 17:21
LOFT ДЗ 2
/* ДЗ 2 - работа с исключениями и отладчиком */
/*
Задача 1:
Функция принимает массив и фильтрующую фукнцию и должна вернуть true или false
Функция должна вернуть true только если fn вернула true для всех элементов массива
Необходимо выбрасывать исключение в случаях:
- array не массив или пустой массив (с текстом "empty array")
- fn не является функцией (с текстом "fn is not a function")
Зарпещено использовать встроенные методы для работы с массивами
@picpoint
picpoint / index.js
Created August 14, 2019 17:31
LOFT ДЗ 1
/* ДЗ 1 - Функции */
/*
Задание 1:
Функция должна принимать один аргумент и возвращать его
*/
function returnFirstArgument(arg) {
return arg;
}
@picpoint
picpoint / app.js
Created June 22, 2019 10:48
Simple server to express
const express = require('express');
const app = express();
const todos = require('./todos.json');
app.get('/', function (req, res) {
res.send('Home Page');
});
@picpoint
picpoint / script.js
Created June 8, 2019 07:58
Work to flags command line
function getValue (flag) {
const index = process.argv.indexOf(flag);
if (index > -1) {
return process.argv[index + 1];
}
}
const name = getValue('-n');
const mesage = getValue('-m');
@picpoint
picpoint / script.js
Created May 21, 2019 10:33
simple script to work width streams
const fs = require('fs'); // подключаем модуль файловой системы
const zlib = require('zlib'); // подключаем модуль компрессии
const gzip = zlib.createGzip(); // создаём переменную для компрессии
const inp = fs.createReadStream('test.txt'); // входящий поток, чтение файла
const out = fs.createWriteStream('test2.txt.gz'); // исходящий поток, запись компрессионного файла test2.txt.gz
inp.pipe(gzip).pipe(out); // входящий поток, пайпит через поток компрессии и снова пайпит в исходящий поток для создания файла
@picpoint
picpoint / form.html
Created May 15, 2019 20:37
Server for work width POST request and save data on json format
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="/" method="post">
<input type="text" placeholder="Login" name="username">
<input type="password" placeholder="password" name="password">