Skip to content

Instantly share code, notes, and snippets.

View kidroca's full-sized avatar

Peter Velkov kidroca

  • Inceptdevelopment
  • Bulgaria
View GitHub Profile
@kidroca
kidroca / Chart.jsx
Last active November 29, 2023 04:57
Render recharts svg chart inside a PDF document created with react-pdf/renderer
import React from 'react';
import { Global } from 'recharts';
import { htmlSvgToPdfSvg } from '../imageFromSvg';
export const ChartSvg = ({ debug, style, children, width, height }) => {
return chartToPdfSvg(children, width, height, debug, style);
};
const chartToPdfSvg = (children, width, height, debug, style) => {
@kidroca
kidroca / custom-lint-formatter.js
Last active April 2, 2021 11:38
Custom eslint formatter (reporter) making multiple reports for a single lint run
const fs = require('fs');
const fileFormatter = require('eslint/lib/cli-engine/formatters/html');
const outputFormatter = require('eslint/lib/cli-engine/formatters/stylish');
function formatter(results = [], data) {
saveA11yReport(results, data);
const output = outputFormatter(results, data);
return output;
@kidroca
kidroca / helpers.sh
Last active July 11, 2019 12:30
Windows `cmder` Terminal Commands not used regularly enough to remember
### See what's running on port
netstat -a -n -o | grep 5556
### App name using port
tasklist /v | grep 5556
### Another variant but requires elevated privileges
netstat -anob
### Serach cmder history with grep
@kidroca
kidroca / fizz-buzz.js
Last active February 6, 2019 22:02
My Fizz buzz JavaScript solution
new Array(100).fill(1)
.map((_, i) => {
const current = i + 1;
let text = '';
if (current % 3 === 0) text += 'Fizz';
if (current % 5 === 0) text += 'Buzz';
return text || current;
@kidroca
kidroca / SolutionRuleset.ruleset
Last active September 6, 2016 08:40
Visual studio analyzers ruleset for code quality
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="HQC Global Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects. The ruleset includes StyleCop settings as well." ToolsVersion="14.0">
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
<Name Resource="MinimumRecommendedRules_Name" />
<Description Resource="MinimumRecommendedRules_Description" />
</Localization>
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
<Rule Id="CA1016" Action="Warning" />