Skip to content

Instantly share code, notes, and snippets.

@DefV
DefV / scrollTo
Last active December 11, 2015 11:38 — forked from tijsverkoyen/scrollTo
$(document).on('click', 'a[href*="#"]', function(e) {
var $anchor = $(this),
hash = $anchor.attr('href'),
url = hash.substr(0, hash.indexOf('#')),
$hash = $(hash.substr(hash.indexOf('#')));
if(url.indexOf(document.location.pathname) >= 0 && $hash.length > 0)
{
e.preventDefault();
@DefV
DefV / gist:241852
Created November 24, 2009 12:52 — forked from pjaspers/gist:241847
require 'lingua/en/readability'
class Haiku
def initialize(text)
@report = Lingua::EN::Readability.new(text)
@used_words = Array.new
end
def get_most_used_words(words)
top_words = Array.new
words.sort{|a,b| a[1]<=>b[1]}.slice(words.length/2..words.length).each do |a|