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 May 20, 2025 20:33
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)`
# Version 2:
# This version preserves space, including indentation.
#
# Also if you have lists like this:
#
# foo ....... bla bla bla
# bar baz ... bla bla bla bla
#
# It will re-formated it to e.g. this:
#
@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: [
@maximlt
maximlt / run_python_script_in_conda_env.bat
Last active May 2, 2025 11:15
Run a Python script in a conda environment from a batch file
@echo OFF
rem How to run a Python script in a given conda environment from a batch file.
rem It doesn't require:
rem - conda to be in the PATH
rem - cmd.exe to be initialized with conda init
rem Define here the path to your conda installation
set CONDAPATH=C:\ProgramData\Miniconda3
rem Define here the name of the environment
@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 May 30, 2025 15:19
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 June 5, 2025 19:50
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}];}`;