Skip to content

Instantly share code, notes, and snippets.

View AdamWagner's full-sized avatar

Adam Wagner AdamWagner

View GitHub Profile
@AdamWagner
AdamWagner / LevDis.gs
Created November 19, 2018 20:40
Levenshtein Distance Function for Google Sheets
//
// Levenshtein Distance Function for Google Sheets
//
// This function calculates de Levenshtein Distance (or Edit Distance) between two strings.
// I used the algorith and code from Wikipedia (https://en.wikipedia.org/wiki/Levenshtein_distance)
// as a reference and just adjusted the code to be used on Google Sheets.
//
// By: Manoel Lemos / manoel@lemos.net / http://manoellemos.com
//
// IMPORTANT: I added some code in the begining of the function to try to solve the issues
@AdamWagner
AdamWagner / bash-cheatsheet.sh
Created September 9, 2018 04:52 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
function! Strip(string)
return substitute(a:string, '^\s*\(.\{-}\)\s*\n\?$', '\1', '')
endfunction
function! TargetedTmuxCommand(command, target_pane)
return a:command . " -t " . a:target_pane
endfunction
function! SendTmuxCommand(command)
@AdamWagner
AdamWagner / workflow-build.py
Created August 19, 2018 21:49 — forked from duanemay/workflow-build.py
Build Alfred Workflows into .alfredworkflow (zip) files
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 deanishe@deanishe.net.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
@AdamWagner
AdamWagner / download-svgs.js
Created August 3, 2018 04:14
Download SVGs from web pages
var e = document.createElement('script');
e.setAttribute('src', 'https://nytimes.github.io/svg-crowbar/svg-crowbar.js');
e.setAttribute('class', 'svg-crowbar');
document.body.appendChild(e);
@AdamWagner
AdamWagner / script.js
Created July 29, 2018 19:31
Userscript: Google Docs Shortcuts / Vim mode
// ==UserScript==
// @name Google Docs Shortcuts
// @include http*://docs.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
var editor = document.getElementsByClassName("docs-texteventtarget-iframe")[0].contentWindow.document.querySelector("[contenteditable=\"true\"]");
@AdamWagner
AdamWagner / surfingkeys.js
Last active November 27, 2018 00:56
surfingkeys
/*
Default key bindings reference:
https://github.com/brookhong/Surfingkeys/blob/master/pages/default.js
#Inpsiring configurations
@mindgitrwx
https://github.com/mindgitrwx/gitconventions/blob/master/SurfingKeys-config-ko.js
@AdamWagner
AdamWagner / Navicon-Transformicons.markdown
Created October 7, 2013 20:48
A Pen by Bennett Feely.
@AdamWagner
AdamWagner / WP Get post word count
Created November 30, 2012 03:26
Get the word count of a WordPress blog post
/*
Word count
*/
function wcount(){
ob_start();
the_content();
$content = ob_get_clean();
return sizeof(explode(" ", $content));
}