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.spinner = function(duration) { | |
var props = { | |
rotation: 0, | |
tick: (duration || 1000) / 32, | |
stop: function() { | |
clearTimeout(this.timeout); | |
}, | |
start: function() { | |
var p = this; | |
p.timeout = setTimeout(function() { |
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 selleck(tmpl, obj, chain) { | |
chain = chain || ""; | |
for (var v in obj) { | |
if (typeof obj[v] === "object") { | |
tmpl = selleck(tmpl, obj[v], chain + v + "."); | |
} | |
tmpl = tmpl.replace((new RegExp("{{" + chain + v + "}}", "g")), obj[v]); | |
} | |
return tmpl; | |
} |
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.random = function(qty) { | |
var $pool = this, | |
$picks = $(), | |
$e; | |
qty = qty || 1; | |
while (qty) { | |
$e = $pool.eq(~~(Math.random() * $pool.length)); | |
$picks = $picks.add($e); | |
$pool = $pool.not($e); |
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.smartToggle = function(bool, prop) { | |
prop = prop || bool; | |
return this.each(function() { | |
var $e = $(this); | |
if (bool === prop) { | |
$e.is(":visible") ? $e.hide() : $e.css("display", prop); | |
} | |
else { | |
bool ? $e.css("display", prop) : $e.hide(); |
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
= gradient-bg-horizontal($color1, $color2) | |
background-color: $color2 | |
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#{ie-hex-str($color1)}, endColorstr=#{ie-hex-str($color2)}) | |
-ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr=#{ie-hex-str($color1)}, endColorstr=#{ie-hex-str($color2)}) | |
background-image: -moz-linear-gradient(100% 100% 180deg, $color2, $color1) | |
background-image: -webkit-gradient(linear, left center, right center, from($color1), to($color2)) |
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
Array.prototype.forEach.call(document.querySelectorAll("iframe"), function(el) { el.parentNode.removeChild(el); }); |
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
.rating | |
.current.three | |
- %w(one two three four five).each do |rating| | |
= link_to rating, "#", class: rating |
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
$colors: lighten(#026dbd, 45%), lighten(#fad52c, 20%), lighten(#f17d32, 20%), lighten(#da1c1c, 25%), lighten(#8266ba, 20%), lighten(#7bb545, 17%) | |
$i: 1 | |
@each $color in $colors | |
&:nth-child(#{$i}) | |
background-color: $color | |
$i: $i + 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 codemirror_overrides = { | |
setMarker: function(line, gutter_text, line_class) { | |
if (!this.markers) { this.markers = []; } | |
this.markers.indexOf(line) === -1 && this.markers.push(line); | |
this._setMarker(line, gutter_text, line_class); | |
}, | |
clearMarkers: function(line) { | |
var e = this; | |
if (!e.markers) { return; } | |
if (line) { |
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
Storage.prototype.setObject = function(key, value) { | |
this.setItem(key, JSON.stringify(value)); | |
}; | |
Storage.prototype.getObject = function(key) { | |
return JSON.parse(this.getItem(key)); | |
}; |