Skip to content

Instantly share code, notes, and snippets.

View boostbob's full-sized avatar
💣
Born to try

Bob Wang boostbob

💣
Born to try
  • boostbob
  • Chengdu, Sichuan, China
View GitHub Profile
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
else
link(page, "#", :class => 'active')
end
@boostbob
boostbob / gist:5715239
Created June 5, 2013 16:25
foundation interchange named queries
named_queries : {
'default' : 'only screen and (min-width: 1px)',
small : 'only screen and (min-width: 768px)',
medium : 'only screen and (min-width: 1280px)',
large : 'only screen and (min-width: 1440px)',
landscape : 'only screen and (orientation: landscape)',
portrait : 'only screen and (orientation: portrait)',
retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),'
+ 'only screen and (min--moz-device-pixel-ratio: 2),'
+ 'only screen and (-o-min-device-pixel-ratio: 2/1),'
@boostbob
boostbob / gist:5715171
Created June 5, 2013 16:16
foundation interchange resize
resize : function () {
var cache = this.cache;
for (var uuid in cache) {
if (cache.hasOwnProperty(uuid)) {
var passed = this.results(uuid, cache[uuid]);
if (passed) {
this.settings.directives[passed
.scenario[1]](passed.el, passed.scenario[0]);
@boostbob
boostbob / gist:5715065
Created June 5, 2013 16:02
foundation interchange ie load callback fix
loaded : function (image, last, callback) {
function loaded () {
callback(image[0], last);
}
function bindLoad () {
this.one('load', loaded);
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
var src = this.attr( 'src' ),
@boostbob
boostbob / gist:5715011
Created June 5, 2013 15:55
foundation interchange uuid
uuid : function (separator) {
var delim = separator || "-";
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return (S4() + S4() + delim + S4() + delim + S4()
+ delim + S4() + delim + S4() + S4() + S4());
},
@boostbob
boostbob / gist:5714941
Created June 5, 2013 15:48
foundation image markup changed
<img data-interchange="[http://foundation.zurb.com/docs/img/demos/interchange/smallest.jpg, (default)],
[http://foundation.zurb.com/docs/img/demos/interchange/smallest.jpg, (screen and (max-width: 568px))],
[http://foundation.zurb.com/docs/img/demos/interchange/small.jpg, (small)],
[http://foundation.zurb.com/docs/img/demos/interchange/large.jpg, (large)]"
src="http://foundation.zurb.com/docs/img/demos/interchange/small.jpg"
data-uuid="c78d3e8b-0142-34af-30d3-5afdcb4c42b6"
>
@boostbob
boostbob / gist:5714684
Last active December 18, 2015 02:58
foundation interchange example image tag
<div class="row">
<div class="large-12 columns">
<img src="http://foundation.zurb.com/docs/img/demos/interchange/smallest.jpg"
data-interchange="[http://foundation.zurb.com/docs/img/demos/interchange/smallest.jpg, (default)],
[http://foundation.zurb.com/docs/img/demos/interchange/smallest.jpg, (screen and (max-width: 568px))],
[http://foundation.zurb.com/docs/img/demos/interchange/small.jpg, (small)],
[http://foundation.zurb.com/docs/img/demos/interchange/large.jpg, (large)]">
</div>
</div>
@boostbob
boostbob / gist:5714666
Last active December 18, 2015 02:58
foundation interchange example javascript initialize
<script> document.write('<script src=' + ('__proto__' in {} ? 'javascripts/vendor/zepto' : 'javascripts/vendor/jquery') + '.js><\/script>') </script>
<script src="javascripts/foundation/foundation.js"></script>
<script src="javascripts/foundation/foundation.interchange.js"></script>
<script> $(document).foundation(); </script>
@boostbob
boostbob / gist:5712682
Created June 5, 2013 09:16
foundation interchange custom named queries
$(document).foundation('interchange', {
named_queries : {
my_custom_query : 'only screen and (max-width: 200px)'
}
});
@boostbob
boostbob / gist:5712676
Last active December 18, 2015 02:39
foundation interchange named queries retina
<img src="/path/to/default.jpg"
data-interchange="[image_path, (screen and only (min-width: 640px) and (-webkit-min-device-pixel-ratio: 2))]"
/>