Skip to content

Instantly share code, notes, and snippets.

patik / styles.css
Last active Jun 8, 2021 — forked from joshbode/
Numbered Headings in Markdown via CSS
View styles.css
h1 { counter-reset: h2counter; }
h2 { counter-reset: h3counter; }
h3 { counter-reset: h4counter; }
h4 { counter-reset: h5counter; }
h5 { counter-reset: h6counter; }
h6 {}
h2:before {
counter-increment: h2counter;
content: counter(h2counter) ".\0000a0\0000a0";
patik / format-commas.js
Last active Jun 22, 2021
Format number with commas
View format-commas.js
// Converts "1234567.89" => "1,234,567.89"
function formatNumberWithCommas(number) {
const parts = number.split('.')
return ('' + parts[0]) // Convert to a string
.split('').reverse().join('') // Reverse the order of the characters (which are all digits at this point)
.replace(/(...)/g, '$1,') // Insert a comma after every three digits
.split('').reverse().join('') // Un-reverse the characters
.replace(/^,/, '') // Remove any commas that were added to the beginning (i.e. if the number of digits was a multiple of three)
.concat(parts[1] ? '.' + parts[1] : '') // Re-add the decimal, if any
View osx-special-chars.ahk
!VKC0SC029::Return ; grave -> the grave ` accent gave some probs, used the virtualkey + scancode instead
!e::Return ; acute
!i::Return ; circumflex
!t::Return ; tilde
!u::Return ; umlaut
; 1 2 3 4 5 6 7 8 9 1
; 0
; r g G a A c C t T u U
View file.html
<!DOCTYPE html>
<html lang="en">
window.ts_endpoint_url = "https:\/\/\/beacon\/timing";
(function(e) {
var n = ? : +new Date,
r = e.performance || {},
patik /
Created Nov 13, 2015
Git and Node with Zscaler proxy
# Git proxy settings
echo "Configuring Git..."
git config --global http.proxy
git config --system http.proxy
git config --global http.sslVerify false
git config --system http.sslVerify false
git config --global --unset http.sslcainfo
git config --system --unset http.sslcainfo
patik /
Last active Sep 14, 2015
Popover plugin specifications



The popover plugin displays HTML in a container that overlays the page. It is triggered by clicking on a button or other UI element and the container is positioned near the element. The popover can be displayed and hidden at will.


The plugin must be provided with an options object and a jQuery collection of elements.

patik /
Last active Sep 9, 2021
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

patik /
Last active Oct 17, 2017
Proxy config for Git and Node at DTF

Download and install these first:

  • NodeJS
  • Git for Windows
    • During installation, on the options screen with the check boxes about what to install, check the box for TrueType fonts
    • On the screen with three radio button options about the shell and Windows Command Prompt, choose the second option
    • Go with the default options for the rest of the installation
  • SourceTree
    • This is similar to GitHub's app, but more powerful and flexible
patik / .bashrc
Last active Sep 9, 2021
Bash configure proxy for corporate network
View .bashrc
# configure proxy for git while on corporate network
# From
function proxy_on(){
# are existing Windows system-level environment variables
# are existing Windows current user-level environment variables (your user)
# environment variables are UPPERCASE even in git bash
patik / data.js
Created Jun 18, 2014
Simple JSON path parser
View data.js
// Source data (JSON) from the server
data = {
abc: {
def: {
ghi: 'jkl'
// The path you're looking for (you want the value of `ghi`)