This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @param [jQuery Object] target Dom element to scroll to | |
# @param [Integer] speed Speed (pixels per second) | |
$.fn.scrollWithSpeed = (target, speed = 10000, easing, complete) -> | |
@stop().animate( | |
scrollTop: target.offset().top | |
, Math.abs($(window).scrollTop() - target.offset().top) / speed * 1000 | |
, easing | |
, complete ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DeepStruct < OpenStruct | |
def initialize(hash = nil) | |
check_hash = lambda { |entry| entry.is_a?(Hash) ? self.class.new(entry) : entry } | |
@table = {} | |
@hash_table = {} | |
hash.try(:each) do |key, val| | |
if val.is_a?(Array) | |
other = Array.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nokogiri_xml_to_hash = lambda do |node| | |
out_hash = {} | |
return out_hash if node.nil? | |
node.attributes.each { |k,_| out_hash[k] = node.attr(k) } | |
node.elements.try(:each) do |elem| | |
prop = nokogiri_xml_to_hash(elem) | |
if prop.is_a?(Array) && prop.size > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var duplicates = function(array) { | |
var iteratee = array.slice(0); | |
var seen = []; | |
return array.filter(function(element) { | |
iteratee.shift(); | |
if (seen.indexOf(element) !== -1) return false; | |
var hit = iteratee.indexOf(element) !== -1; | |
if (hit && seen.indexOf(element) === -1) seen.push(element); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var simpleUniq = function(array) { | |
return array.reduce(function(prev, curr, index, arr) { | |
if (prev.indexOf(curr) === -1) prev.push(curr); | |
return prev; | |
}, []); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:invalid { | |
box-shadow: none; | |
} | |
:-moz-submit-invalid { | |
box-shadow: none; | |
} | |
:-moz-ui-invalid { | |
box-shadow:none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html, <html contenteditable><head><title>::Quick Notes::</title><script>window.onbeforeunload=function(e){return e.returnValue=true};</script></head><body><ol><li></li></ol></body></html> |