Skip to content

Instantly share code, notes, and snippets.

@agentmilindu
agentmilindu / gist:3411402
Last active October 9, 2015 00:28 — forked from jmblog/gist:3222899
Simple HTML encoding/decoding using jQuery
// http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding
function htmlEncode(value){
return $('<div/>').text(value).html();
}
function htmlDecode(value){
return $('<div/>').html(value).text();
}
@agentmilindu
agentmilindu / pre-commit
Last active December 23, 2017 07:45 — forked from broofa/pre-commit
Git pre-commit hook that runs `eslint`
#!/bin/bash
cd "$(git rev-parse --show-toplevel)"
ESLINT="node_modules/.bin/eslint"
pwd
if [[ ! -x "$ESLINT" ]]; then
printf "\t\033[41mPlease install ESlint\033[0m (npm install eslint)\n"
exit 1
fi