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
"Advanced CSV", | |
"AdvancedNewFile", | |
"AlignTab", | |
"All Autocomplete", | |
"ApplySyntax", | |
"AutoFileName", | |
"Autoprefixer", | |
"BeautifyRuby", | |
"Better CoffeeScript", | |
"BracketHighlighter", |
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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
# with their associated values. Most useful for calling named scopes from |
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
Ok, so Inheritance | |
its not just for young white dudes waiting for their grandparents to fucking keel over at 82. | |
In ruby, Inheritance allows one class to inherit from another class attributes and behaviors (methods) that it didnt have before. The inheriter, much like a young white male, is the child class. The class that it inherits from, rather than being his old money grandparents, is the Parent Class. The lesson says Inheritance is designated with a < symbol, for example: | |
class Daughter < Father | |
end | |
wow, quick right. So for that, the daughter is getting methods from the father. Simple right. But lets go deeper and se how fucked up this can really get for those of us in the cheap seats. |
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 |
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
# 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
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
/* 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
<?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
<!-- 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 }}"> |