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
@import "whitespace-reset" | |
$prefixes: moz, ms, webkit, khtml, o | |
@function ie_color_fix($color) | |
@if $color == #ffffff | |
$color: #fffffe | |
@else if $color == #fff | |
$color: #fffffe | |
@else if $color == #000000 |
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
(function($) { | |
$.fn.tooltip = function() { | |
// Grabs its content from the next sibling .tooltip_content element, eg: | |
// = link_to "Remove", "#", "data-tooltip" => "" | |
// .tooltip_content | |
// %p This is my tooltip | |
// Sets a class of right or left on tooltip based on what edge of the trigger it's using | |
return this.each(function() { | |
var $el = $(this), |
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
$.fn.serializeObject = function() { | |
var obj = {}; | |
if (!this.is("form")) { return this; } | |
this.find(":input").not("[disabled], :submit").each(function() { | |
obj[this.name] = isNaN(+this.value) ? this.value : +this.value; | |
}); | |
return obj; | |
}; |
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
$.fn.cssGradient = function(start, end) { | |
end = end || start; | |
if (!start) { return this; } | |
return this.css({ | |
"background-image": "-moz-linear-gradient(100% 100% 90deg, " + end + ", " + start + ")", | |
"background-image": "-webkit-gradient(linear, 0% 0%, 0% 100%, from(" + start + "), to(" + end + "))", | |
"-ms-filter": "progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=" + start + ", endColorstr=" + end + ")" | |
}); | |
}; |
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
// shadeColor("#f0f0f0", -20) returns "#bdbdbd" | |
function shadeColor(color, percent) { | |
var num = parseInt(color.slice(1), 16), | |
amt = Math.round(2.55 * percent), | |
R = (num >> 16) + amt, | |
B = (num >> 8 & 0x00FF) + amt, | |
G = (num & 0x0000FF) + amt; | |
return "#" + ( | |
0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 |
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
// Usage: `dom_element.classList.addAll(["foo", "bar"], "baz")` and `dom_element.classList.removeAll("foo", ["bar", "baz"])` | |
// See http://jsbin.com/obenin for demo | |
(function() { | |
var args; | |
var flattenArgs = function(collection) { | |
if (typeof collection === "string") { | |
args.push(collection); | |
return; | |
} | |
collection = Array.prototype.slice.call(collection); |
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
Scene = function(opts) { | |
var instance = { | |
layers: [], | |
renderLayer: function(layer) { | |
// data: [array of tiles, 1-based, position of sprite from top-left] | |
// height: integer, height in number of sprites | |
// name: "string", internal name of layer | |
// opacity: integer | |
// type: "string", layer type (tile, object) | |
// visible: boolean |
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
BinaryObject = function(a, b) { | |
var o = { | |
0: a, | |
1: b, | |
val: function(bool) { return bool ? this[1] : this[0]; } | |
}; | |
return o; | |
}; | |
var bin = new BinaryObject("no", "yes"); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="toggleText.js"></script> | |
<meta charset=utf-8 /> | |
<title>Character Limit</title> | |
</head> | |
<body> | |
<a href="#" data-alt_text="Unfriend">Add to friends</a> |
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
{ "height":15, | |
"layers":[ | |
{ | |
"data":[79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 60, 61, 62, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 77, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 15, 78, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 16, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 31, 78, 30, 95, 96, 95, 96, 79, 80, 95, 156, 157, 158, 95, 96, 79, 80, 95, 28, 76, 32, 78, 112, 13, 13, 79, 80, 95, 96, 79, 172, 173, 144, 158, 80, 95, 96, 79, 28, 76, 47, 48, 61, 61, 62, 95, 96, 79, 80, 156, 143, 138, 160, 190, 96, 12, 13, 13, 111, 76, 16, 15, 16, 31, 78, 13, 13, 14, 96, 172, 138, 173, 174, 79, 80, 44, 45, 45, 127, 92, 93, 93, 93, 93, 94, 109, 110, 30, 80, 188, 189, 189, 190, 95, 96, 79, 80, 95, 44, 45, 45, 45, 45, 45, 45, 141, 142, 30, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 45, 45, 46, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, |