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
(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
@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
prefixes = moz, ms, webkit, khtml, o | |
font-smoothing() | |
-webkit-font-smoothing: antialiased | |
image-smoothing() | |
image-rendering:optimizeSpeed | |
image-rendering:-webkit-optimize-contrast | |
image-rendering: -moz-crisp-edges | |
-ms-interpolation-mode: nearest-neighbor |
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
input[type="search"] | |
-webkit-appearance: none | |
-moz-appearance: none | |
input[type='search']::-webkit-search-decoration, | |
input[type='search']::-webkit-search-cancel-button, | |
input[type='search']::-webkit-search-results-button, | |
input[type='search']::-webkit-search-results-decoration | |
display: 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
-# Middleman doesn't like options_for_select, have to run through manually | |
%select(name="state") | |
- states.each do |name, val| | |
%option(value="#{val}")= name | |
-# If we're in Rails land | |
= select_tag :state, options_for_select(states) |
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
// Writing JS for everything is great and all, but I don't want to see JS | |
// inline in my Jade templates. Thankfully, there are ways of abstrating it | |
// into mixins! | |
// Want some Rails-like helpers? | |
mixin link_to(name, href) | |
- href = href || "#" | |
a(href="#{href}")= name | |
// How about a single editing point for a class name? |
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
// Only one of the strings in the list of colors gets interpolated, thanks | |
// to Stylus converting the color keywords to hex values. | |
// Thanks, Stylus! | |
li | |
for color in red pink orange yellow green blue purple brown black shit | |
&.{color} | |
background: color | |
// What I had to do instead to make it work. Note that simply wrapping the |
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 templates = (function() { | |
var o = {}; | |
$("[type=\"text/x-handlebars\"]").each(function() { | |
o[$(this).attr("data-id")] = Handlebars.compile(this.innerHTML); | |
}); | |
return o; | |
})(); |
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 lang="en-US"> | |
<head> | |
<title></title> | |
<meta charset="UTF-8" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
</head> | |
<body> | |
</body> |