Skip to content

Instantly share code, notes, and snippets.

Craig Patik patik

Block or report user

Report or block patik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@patik
patik / styles.css
Last active Mar 25, 2019 — forked from joshbode/numbered_headings.md
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
patik / format-commas.js
Last active Nov 7, 2016
Format number with commas
View format-commas.js
// Converts `1234567` => `"1,234,567"
// Does not support decimals yet
function formatNumberWithCommas (number) {
return ('' + number) // 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)
};
View osx-special-chars.ahk
#UseHook
!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">
<head>
<script>
window.ts_endpoint_url = "https:\/\/slack.com\/beacon\/timing";
(function(e) {
var n = Date.now ? Date.now() : +new Date,
r = e.performance || {},
@patik
patik / git-setup.sh
Created Nov 13, 2015
Git and Node with Zscaler proxy
View git-setup.sh
#!/bin/sh
# Git proxy settings
echo "Configuring Git..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
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
patik / popover.md
Last active Sep 14, 2015
Popover plugin specifications
View popover.md

Popover

Overview

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.

Usage

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

@patik
patik / how-to-squash-commits-in-git.md
Last active May 8, 2019
How to squash commits in git
View how-to-squash-commits-in-git.md

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
patik / 1.install.md
Last active Oct 17, 2017
Proxy config for Git and Node at DTF
View 1.install.md

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
patik / .bashrc
Last active Apr 24, 2019
Bash configure proxy for corporate network
View .bashrc
# configure proxy for git while on corporate network
# From https://gist.github.com/garystafford/8196920
function proxy_on(){
# assumes $USERDOMAIN, $USERNAME, $USERDNSDOMAIN
# are existing Windows system-level environment variables
# assumes $PASSWORD, $PROXY_SERVER, $PROXY_PORT
# are existing Windows current user-level environment variables (your user)
# environment variables are UPPERCASE even in git bash
@patik
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`)
You can’t perform that action at this time.