Skip to content

Instantly share code, notes, and snippets.

# Defining the keys
def current_key
key(Time.now.strftime("%M"))
end
def keys_in_last_5_minutes
now = Time.now
times = (0..5).collect {|n| now - n.minutes }
times.collect{ |t| key(t.strftime("%M")) }
@biruwon
biruwon / truncate.js
Created May 23, 2013 10:49
jQuery truncate
<script>
(function($){
$.fn.truncate = function(options) {
var defaults = {
length: 330,
minTrail: 0,
ellipsisText: "..."
};
var options = $.extend(defaults, options);