Skip to content

Instantly share code, notes, and snippets.

View beardlessman's full-sized avatar

Dmitrii Mungalov beardlessman

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="https://unpkg.com/mocha@8/mocha.css" />
<link rel="stylesheet" href="style.css" />
<script
@beardlessman
beardlessman / postcss-bundler.bash
Created June 14, 2020 02:48
Простая сборка стилей с помощью postcss
npm install postcss-cli postcss-import postcss-media-minmax postcss-csso
npx postcss styles/index.css --use postcss-import --use postcss-media-minmax --use postcss-csso --no-map --output styles/index.min.css
Источник: https://youtu.be/0_v36dyI3kI?t=842
@beardlessman
beardlessman / duplicate.sh
Created May 26, 2020 05:56
Найти дубликаты в коде
npx jscpd --ignore 'node_modules/**/*' .
@beardlessman
beardlessman / ProfileSelectWithHooks.tsx
Created April 14, 2020 06:05
Profile Select With Hooks
import { Select, Spin } from 'antd';
import { IProfile } from 'modules/user/types';
import React, { useState } from 'react';
import debounce from 'lodash/debounce';
import uniqWith from 'lodash/uniqWith';
const { Option } = Select;
interface IResponse {
import React, { useState, useEffect } from 'react';
function useFriendStatus(friendID) {
const [isOnline, setIsOnline] = useState(null);
function handleStatusChange(status) {
setIsOnline(status.isOnline);
}
useEffect(() => {
@beardlessman
beardlessman / hookExample.js
Created September 4, 2019 06:50
react hook example, flow
//@flow
import React, { useState, useEffect } from 'react';
type IProps = {
initial?: number,
};
export default function HookExample({ initial = 0 }: IProps) {
const [fuckingCount, setFuckingCount] = useState(initial);
@beardlessman
beardlessman / print.js
Created June 4, 2019 01:22
.toString() энкодит utf-8?
import fs from 'fs';
const print1 = path => {
fs.readFile(path, (err, content) => console.log(content.toString()));
}
const print2 = path => fs.readFile(
path,
'utf-8',
(error, data) => console.log(data),
const propertyActions = [
{
name: 'body',
check: arg => typeof arg === 'string'
},
{
name: 'children',
check: arg => arg instanceof Array
},
{
const metadata = {
title: 'Scratchpad',
translations: [
{
locale: 'de',
title: 'Javascript-Umgebung'
}
],
url: '/en-US/dosc/Tools/Scratchpad'
};
// SERVER
const axios = require('axios');
module.exports = () => {
const io = require('socket.io')();
io.listen(3000);
io.on('connection', function(socket) {
socket.on('SEARCH_REQUEST', query => {
axios