This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| .particleJs | |
| background-color transparent | |
| width 35% | |
| height 100% | |
| display block | |
| position absolute | |
| top 0px | |
| left 0px |
This file contains hidden or 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
| #!/bin/bash | |
| files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
| # Prevent ESLint help message if no files matched | |
| if [[ $files = "" ]] ; then | |
| exit 0 | |
| fi | |
| failed=0 | |
| for file in ${files}; do |