Skip to content

Instantly share code, notes, and snippets.

David Condrey dcondrey

View GitHub Profile
@dcondrey
dcondrey / savetoDoc.js
Created Aug 5, 2017
Export an HTML element to Microsoft Word with CSS styles to set page orientation and paper size.
View savetoDoc.js
/* HTML to Microsoft Word Export
* This code demonstrates how to export an html element to Microsoft Word
* with CSS styles to set page orientation and paper size.
* Tested with Word 2010, 2013 and FireFox, Chrome, Opera, IE10-11
* Fails in legacy browsers (IE<10) that lack window.Blob object
*/
function saveDoc() {
if (!window.Blob) {
alert('Your legacy browser does not support this action.');
View macos-vpn-setup.sh
#!/bin/sh
# Random UUID for this config
vpnUuid=``
# Address of VPN server
serverName=""
# The group of usernames that is allowed in
groupName=""
# The name of connection type displayed in GUI
labelName=""
# The Shared Secret
View .gitconfig
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
View Javascript OO Cheat Sheet
/***********************************************************************************************************************
***********************************************************************************************************************
* CONTENTS:
* Native Object
* Object Literal
* Basic Object
* Psuedo-Class
* Self Executing/Invoking Structure
* Lazy Function
* Module Pattern
@dcondrey
dcondrey / defaultPluginName.js
Last active Apr 20, 2016
jQuery boilerplate plugin
View defaultPluginName.js
/*!
* jQuery plugin boilerplate
*/
;(function ( $, window, document, undefined ) {
/**
* @defaults
* @property pluginName {string} Plugin name
* @property defaults {object} Default values for plugin
@dcondrey
dcondrey / ffmpegchapters-explicit.sh
Created Apr 20, 2016
Use ffmpeg to split file by chapters. Python version and bash version
View ffmpegchapters-explicit.sh
#!/bin/bash
# Author: http://crunchbang.org/forums/viewtopic.php?id=38748#p414992
# m4bronto
# Chapter #0:0: start 0.000000, end 1290.013333
# first _ _ start _ end
while [ $# -gt 0 ]; do
ffmpeg -i "$1" 2> tmp.txt
@dcondrey
dcondrey / imacros-cheatsheet.md
Last active Dec 3, 2018 — forked from LeCoupa/imacros-cheatsheet.js
iMacros Command, Variable, and function reference
View imacros-cheatsheet.md
View contrast-color.js
/**
* Calculate the contrast of a color to determine the appropriate opposing text color.
* @author D. Condrey
* @param {string|object} - element background-color or element
* @return {string}
* white - if background is a dark shade color
* black - if background is a light shade color
*/
define(function() {
View handlebars-demodata.xml
<?xml version="1.0" encoding="UTF-8"?>
<data>
<test>test</test>
<strings>
<string id="SITE_TITLE"><![CDATA[Title]]></string>
</strings>
<quiz>
<page>
<question><![CDATA[Question 1]]></question>
<answers>
You can’t perform that action at this time.