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 preload() { | |
var images = []; | |
var i; | |
for ( i = 0; i < preload.arguments.length; i++ ) { | |
images[ i ] = new Image(); | |
images[ i ].src = preload.arguments[ i ]; | |
} | |
} | |
preload( |
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.scrollStopped = function(callback) { | |
$(this).scroll(function(){ | |
var self = this, $this = $(self); | |
if ($this.data('scrollTimeout')) { | |
clearTimeout($this.data('scrollTimeout')); | |
} | |
$this.data('scrollTimeout', setTimeout(callback,300,self)); | |
}); | |
}; |
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
// Given a query string "?to=email&why=because&first=John&Last=smith" | |
// getUrlVar("to") will return "email" | |
// getUrlVar("last") will return "smith" | |
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/ | |
function getUrlVar(key){ | |
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); | |
return result && unescape(result[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
<!-- Formulario y botón "agregar al carro" en plantilla product.html. | |
Los data-attributes son necesarios para la API Ajax del carrito (opcional) --> | |
<form class="add_to_cart" action="{{ add_to_cart_url }}" method="post" data-bootic-cart-add="add" data-bootic-productId="{{ product.id }}"> | |
<!-- si hay más de 1 variante, muéstralas en una lista --> | |
{% if product.variants_count > 1 %} | |
<h4>{{ 'activerecord.models.variant' | t }}</h4> | |
<ul class="variants"> | |
<!-- primero las variantes disponibles --> | |
{% for variant in product.available_variants %} | |
<li class="bootic_variant available {% cycle 'odd', 'even' %} av-variant-{{ forloop.index }}"> |
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
<?php for( $i = 0; $i < 9; $i++ ) : ?> | |
<p><?php echo cycle('one', 'two', 'three') ?></p> | |
<?php endfor; ?> |
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
/* apply a natural box layout model to all elements, but allowing components to change */ | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |
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
module ApplicationHelper | |
def bootstrap_class_for flash_type | |
{ success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type.to_sym] || flash_type.to_s | |
end | |
def flash_messages(opts = {}) | |
flash.each do |msg_type, message| | |
concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} alert-dismissible", role: 'alert') do | |
concat(content_tag(:button, class: 'close', data: { dismiss: 'alert' }) do |
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
# This one goes to the API file. | |
before do | |
next if @resource | |
@req = ::AuthenticatedRequest.new( | |
uid: request.headers['Uid'], | |
token: request.headers['Access-Token'], | |
client: request.headers['Client'], | |
resource: @resource | |
) |
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
<!-- jQuery --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="/assets/js/vendor/jquery-1.11.1.min.js"><\/script>')</script> | |
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> |
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
echo "* Updating system" | |
apt-get update | |
apt-get -y upgrade | |
echo "* Installing packages" | |
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop | |
id -u deploy &> /dev/null | |
if [ $? -ne 0 ] | |
then |