Skip to content

Instantly share code, notes, and snippets.

View chris-vecchio's full-sized avatar

Chris Vecchio chris-vecchio

View GitHub Profile
@deppen8
deppen8 / documenting-your-code-links.md
Last active December 18, 2022 19:43
Links in the `documenting-your-code` tutorial
@panzi
panzi / smart_formatter.py
Last active February 28, 2024 22:32
Python argparse help formatter that keeps new lines and doesn't break words (so URLs are preserved), but still wraps lines. Use with: `argparse.ArgumentParser(formatter_class=SmartFormatter)`
import argparse
from typing import List
class SmartFormatter(argparse.HelpFormatter):
def _split_lines(self, text: str, width: int) -> List[str]:
lines: List[str] = []
for line_str in text.split('\n'):
line: List[str] = []
line_len = 0
for word in line_str.split():
@Firenza
Firenza / fiddler_with_python.md
Last active January 20, 2024 02:49
Get fiddler working with python requests module

Get fiddlers base64 encoded root certificate

  1. Install fiddler winget install -e --id Telerik.Fiddler
  2. Open fiddler and go to Tools -> Options -> HTTPS
  3. Enable Decrypt HTTPS traffic
  4. Click the Actions button and select Export root certificate to desktop
  5. Right click the FiddlerRoot.cer file on the desktop and click Open with -> Crypto Shell Extensions
  6. In the Certificate window that opens up go to Details -> Copy to File
  7. Click Next then select Base-64 encoded X.509 (.CER) then specify the file name (E.G. FiddlerRootBase64.cer)
  8. Click Next to create the new file
@dankremniov
dankremniov / Chart.tsx
Last active February 21, 2024 06:41
Render React component for Highcharts tooltip
import React, { useState, useCallback } from "react";
import Highcharts, { Chart as HighchartsChart } from "highcharts";
import HighchartsReact from "highcharts-react-official";
import { Tooltip } from "./Tooltip";
const options = {
title: {
text: "Custom tooltip as React component"
},
series: [
@thomaswilburn
thomaswilburn / component.js
Last active April 15, 2020 01:52
So you want to make a primary results component
var ElementBase = require("../elementBase.js");
var Retriever = require("../retriever.js");
/*
Let's make a web component the elections20-primaries way! We're going to start by
subclassing our base element, since it makes the setup a little more declarative.
You'll see how that works in a minute.
*/
class DemoElement extends ElementBase {
@jfcherng
jfcherng / st4-changelog.md
Last active April 20, 2024 00:25
Sublime Text 4 changelog just because it's not on the official website yet.
@kevinchisholm
kevinchisholm / get-script-example-4.js
Last active June 23, 2021 22:03
jQuery.getScript Alternatives - Example 4
function getScript(scriptUrl, callback) {
const script = document.createElement('script');
script.src = scriptUrl;
script.onload = callback;
document.body.appendChild(script);
}
// anonymous function as 2nd argument
getScript('https://bit.ly/get-script-example', function () {
@vimtaai
vimtaai / markdown-flavors.md
Last active July 21, 2024 11:54
Comparison of features in various Markdown flavors

Comparison of syntax extensions in Markdown flavors

I created a crude comparison of the syntax of the various common Markdown extensions to have a better view on what are the most common extensions and what is the most widely accepted syntax for them. The list of Markdown flavors that I looked at was based on the list found on CommonMark's GitHub Wiki.

Flavor Superscript Subscript Deletion*
Strikethrough
Insertion* Highlight* Footnote Task list Table Abbr Deflist Smart typo TOC Math Math Block Mermaid
GFM
@ilokhov
ilokhov / inject-ie-grid.js
Created March 9, 2019 23:37
JS script which injects a stylesheet with prefixed CSS grid properties for Internet Explorer
const ua = window.navigator.userAgent;
const isIE = /MSIE|Trident/.test(ua);
if (!isIE) return;
const styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
const grid = { rows: 2, cols: 4 };
let styleContent = `#grid {display: -ms-grid; -ms-grid-columns: (1fr)[${grid.cols}]; -ms-grid-rows: (1fr)[${grid.rows}];}`;
@Klooven
Klooven / about.md
Last active October 13, 2023 10:35
Customize Bootstrap 4