Skip to content

Instantly share code, notes, and snippets.

View braska's full-sized avatar

Danil Agafonov braska

  • Diligent Corporation
  • Vancouver, Canada
  • 13:34 (UTC -07:00)
View GitHub Profile
@braska
braska / application-stack.ts
Last active July 29, 2023 23:17
Cross-stage Cloudwatch dashboard
interface ApplicationStackProps extends StackProps {
dashboardStack: DashboardStack;
}
export class ApplicationStack extends Stack {
constructor(scope: Construct, id: string, props: ApplicationStackProps) {
super(scope, id, props);
const myFunction = new NodejsFunction(this, 'MyFunction', {
functionName: PhysicalName.GENERATE_IF_NEEDED,
did:3:kjzl6cwe1jw145op9h0mianjjuk1psfve485edvvrit3khvxctclrnlc2ahowo1
@braska
braska / Overlay.jsx
Created May 22, 2019 19:26
React Portals
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import styled, { css } from 'styled-components';
import { rgba } from 'polished';
const Wrapper = styled.div`
position: absolute;
z-index: 10000;
&::before {
const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const path = require('path');
const addHash = (template, hash) =>
NODE_ENV === 'production' ? template.replace(/\.[^.]+(\.map)?$/, `.[${hash}]$&`) : template;
@braska
braska / huffman.go
Created November 13, 2017 00:28
Huffman text encoder/decoder
package main
import (
"flag"
"fmt"
"os"
"bufio"
"math"
"bytes"
"encoding/gob"
@braska
braska / index.pug
Last active September 25, 2022 16:55
Express React SSR
doctype html
<html !{helmet.htmlAttributes.toString()}>
head.
!{helmet.title.toString()}
!{helmet.meta.toString()}
!{helmet.link.toString()}
<body !{helmet.bodyAttributes.toString()}>
#root.
!{content}
script(src=assets['manifest.js'])
@braska
braska / patch.js
Last active March 24, 2017 13:52
Redux Dispatch Monkey Patching
/**
How to use:
1. Inside React Dev Tools select <Provider>
2. Copy this script
3. Paste to console
4. Run
*/
let store = $r.store;
let rawDispatch = store.dispatch;
@braska
braska / output
Created January 10, 2017 12:03
fedora workstation lsmod output
Module Size Used by
hid_logitech_hidpp 28672 0
hid_logitech_dj 20480 0
xt_nat 16384 83
cmac 16384 0
veth 16384 0
xfs 1024000 17
xt_addrtype 16384 2
br_netfilter 24576 0
rfcomm 77824 2
@braska
braska / vk-music-downloader.js
Last active January 11, 2024 20:14
Download first 50 audios from current playlist from VK.com one by one
/*
1. Open Audios
2. Copy this script
3. Insert to developer console and run
4. Enjoy!
*/
//download.js v4.2, by dandavis; 2008-2016. [CCBY2] see http://danml.com/download.html for tests/usage
// v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
@braska
braska / DialogLayout.jsx
Last active August 14, 2016 23:09
Unexpected Remount React Component
import React from 'react';
import {Loader} from 'react-loaders';
import {Button} from 'react-bootstrap';
import DialogTopBar from '../components/DialogTopBar';
import DialogInputBarContainer from '../containers/DialogInputBarContainer';
import DialogMessagesLayoutContainer from '../containers/DialogMessagesLayoutContainer';
export default class DialogLayout extends React.Component {
static propTypes = {
currentDialog: React.PropTypes.object.isRequired,