Skip to content

Instantly share code, notes, and snippets.

View mosbth's full-sized avatar

Mikael Roos mosbth

View GitHub Profile
@mosbth
mosbth / optimize.sh
Last active August 29, 2015 14:22 — forked from lgiraudel/optimize.sh
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@mosbth
mosbth / analyze.js
Last active August 29, 2015 14:21 — forked from bobbzorzen/analyze.js
javascript:
var highlightedText = window.getSelection().toString();
highlightedText = highlightedText.replace("?",".");
highlightedText = highlightedText.replace("!",".");
highlightedText = highlightedText.replace(/\.\.*/g,".");
var sentances = highlightedText.split(".");
var sentanceCount = (highlightedText.match(/\.\s/g) != null) ? highlightedText.match(/\.\s/g).length : 0;
sentanceCount += (highlightedText.slice(-1) == ".") ? 1:0;
var wordCount = highlightedText.split(" ").length;
var avgWordsPerSentance = (wordCount/sentanceCount).toFixed(2);