Skip to content

Instantly share code, notes, and snippets.

View roykolak's full-sized avatar

Roy Kolak roykolak

  • Detective.io
  • Chicago, IL USA
View GitHub Profile
$.fn.spin = function() {
var opts = {lines: 12, length: 5, width: 3, radius: 10, color: '#333', speed: 1, trail: 52, shadow: false};
this.each(function() {
var spinner = $(this).data('spinner');
if (spinner) spinner.stop();
if (opts !== false) {
$(this).data('spinner', new Spinner(opts).spin(this));
}
});
return this;
@roykolak
roykolak / debug.css
Created February 12, 2009 16:44
highlights bad HTML, incomplete tag attributes, and inline javascript
/*
This is a combination of:
http://meyerweb.com/eric/thoughts/2007/09/07/diagnostic-styling/
http://www.nealgrosskopf.com/tech/thread.asp?pid=17
.. with some additional tweaking and additions
*/
/* Empty Attributes */
img[alt=""],
(function($){
jQuery.fn.mouseyDialog = function() {
// Classic Class Structure (note: no var, it's exposed for TDD)
MouseyDialog = function(element) {
// Constructor
}
MouseyDialog.prototype = {
sweetMethod: function() {
// Code
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
class VisitsView extend Backbone.View
initialize: ->
@collection.on 'change', @renderVisits, @
renderVisits: ->
# ....
visits = new Backbone.Collection()
view = new VisitsView
var lookUpISBN = function(isbn, callback) {
var results = {...}
callback(results);
}
(function() {
var displaySearchResults = function(results, $container) {
$container.text(results);
};
@roykolak
roykolak / moment_i18n.js
Created August 2, 2012 15:07
Moment.js i18n in Better History
// Generated by CoffeeScript 1.3.1
(function() {
moment.lang('en', {
months: [
chrome.i18n.getMessage('january'),
chrome.i18n.getMessage('february'),
chrome.i18n.getMessage('march'),
chrome.i18n.getMessage('april'),
chrome.i18n.getMessage('may'),
system = require 'system'
##
# Wait until the test condition is true or a timeout occurs. Useful for waiting
# on a server response or for a ui change (fadeIn, etc.) to occur.
#
# @param testFx javascript condition that evaluates to a boolean,
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
# as a callback function.
# @param onReady what to do when testFx condition is fulfilled,
diff --git a/public/coffeescripts/views/thumbs/thumbs.coffee b/public/coffeescripts/views/thumbs/thumbs.coffee
index f861575..2cffbea 100644
--- a/public/coffeescripts/views/thumbs/thumbs.coffee
+++ b/public/coffeescripts/views/thumbs/thumbs.coffee
@@ -55,6 +55,7 @@ class App.Views.Thumbs.Thumbs extends Backbone.View
hoverOn: (event) ->
return if @thumbClickInProgress
+ @_hideAllTooltips()
$(event.currentTarget).addClass('hover')
.iframe-container {
-webkit-margin-start: -20px;
-webkit-transition: margin 100ms, opacity 100ms;
bottom: 0;
left: 0;
opacity: 0;
position: absolute;
right: 0;
top: 0;
z-index: 1;