Skip to content

Instantly share code, notes, and snippets.

View JoshHighland's full-sized avatar

Josh Highland JoshHighland

View GitHub Profile
@JoshHighland
JoshHighland / mysql-levenshtein.sql
Created April 3, 2019 20:43 — forked from Kovah/mysql-levenshtein.sql
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
# atom
# stop ctrl-c on from wiping out what uyou have in the clipboard
# prevent core:copy if and only if there's one selection in
# the active editor (mini or not) and its length equals 0
atom.commands.add 'atom-text-editor', 'core:copy', (e) ->
editor = e.currentTarget.getModel()
# do nothing if there's more than 1 selection
return if editor.getSelectedBufferRanges().length > 1
@JoshHighland
JoshHighland / compress.liquid
Created September 26, 2017 22:45 — forked from JimmyRittenborg/compress.liquid
HTML Compressor in Shopify Liquid
{% comment %}
Input
{% endcomment %}{% capture _content %}{{ content }}{% endcapture %}{% comment %}
Remove redundant closing tags
{% endcomment %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% for _element in _endings %}
{% capture _end %}</{{ _element }}>{% endcapture %}
@JoshHighland
JoshHighland / index.js
Created May 6, 2017 00:03 — forked from cristianmedeiros/index.js
CSV to SQS throught AWS Lambda
var aws = require('aws-sdk');
aws.config.update({
region: 'us-east-1'
});
var s3 = new aws.S3({apiVersion: '2006-03-01'});
var sqs = new aws.SQS();
var Converter = require('csvtojson').core.Converter;
@JoshHighland
JoshHighland / aws-sns-example.js
Created April 17, 2016 06:39 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();