Skip to content

Instantly share code, notes, and snippets.

View williambsb's full-sized avatar
🎯
Focusing

William Alencar williambsb

🎯
Focusing
  • GoodFy Labs
  • Brasília
View GitHub Profile
Tag Filter:
<ul class="subnav clearfix">
<li{% unless current_tags %} class="active"{% endunless %}>
{% if collection.handle %}
<a href="/collections/{{ collection.handle }}{% if collection.sort_by %}?sort_by={{ collection.sort_by }}{% endif %}">All</a>
{% elsif collection.current_type %}
<a href="{{ collection.current_type | url_for_type | sort_by: collection.sort_by }}">All</a>
@williambsb
williambsb / database_migration_best_practices.md
Created February 9, 2022 16:31 — forked from HelioCampos/database_migration_best_practices.md
Database migration best practices for Rails

Database migration best practices for Rails

Never ever change data on schema changes! [1]

Use rake tasks to change the data! [1]

This decouples a deployment from completed migrations. Give us control of the data manipulation proccess by encapsulatin it in on place. need to remember to:

  1. Run it in one of the ways bellow: a. Add this rake task the deployment script or;
@williambsb
williambsb / better-nodejs-require-paths.md
Created February 9, 2022 16:20 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@williambsb
williambsb / UploadDataOverWifi.ino
Created December 7, 2020 21:31 — forked from jeffThompson/UploadDataOverWifi.ino
How to upload data to a server with Arduino
#include <SPI.h>
#include <WiFi101.h>
/*
UPLOAD DATA OVER WIFI
Jeff Thompson | 2017 | jeffreythompson.org
The great Arduino Wifi101 library includes lots of examples
of how to *get* data from the internet, but no examples on how
@williambsb
williambsb / index.html
Created September 17, 2020 18:27
Rounded tabs Lobby 2
<div class="tabsContainer">
<ul class="tabrow">
<li><a href="#">RF games</a></li>
<li><a href="#">Nyx games</a></li>
<li class="selected"><a href="#">Tom Horn</a></li>
<li><a href="#">gg262</a></li>
<li><a href="#">Other games</a></li>
</ul>
</div>
@williambsb
williambsb / index.html
Created September 17, 2020 17:56
SVG Tabs
<!-- TAB TEMPLATE -->
<svg height="0" width="0" style="position: absolute; margin-left: -100%;">
<defs>
<filter id='shadow'>
<feComponentTransfer in="SourceGraphic">
<feFuncR type="discrete" tableValues="0"/>
<feFuncG type="discrete" tableValues="0"/>
<feFuncB type="discrete" tableValues="0"/>
These days some business have online store in different country with the same name. They have different URL for different country but they are facing a problem that how they can redirect store url based on IP address for eg.
www.domain.us – Customers in the United States
www.domain.ca – Customers in the Canada
www.domain.com – Customers in rest the world
This article guide you to do that.
{% assign sizes = '' %}
{% for product in products limit: limit %}
{% for variant in product.variants %}
{% if variant.available %}
{% assign sizes = sizes | append: variant.options[1] | append: '_' %}
{% endif %}
{% endfor %}
{% endfor %}
{% assign sizesArr = sizes | split: '_' | uniq %}
@williambsb
williambsb / ajax-cart.js
Created June 25, 2020 20:33 — forked from marioloncarek/ajax-cart.js
complete shopify ajax cart solution with drawer and modal, adding and removing products - ugly AF
const defaults = {
cartModal: '.js-ajax-cart-modal', // classname
cartModalContent: '.js-ajax-cart-modal-content', // classname
cartModalClose: '.js-ajax-cart-modal-close', // classname
cartDrawer: '.js-ajax-cart-drawer', // classname
cartDrawerContent: '.js-ajax-cart-drawer-content', // classname
cartDrawerClose: '.js-ajax-cart-drawer-close', // classname
cartDrawerTrigger: '.js-ajax-cart-drawer-trigger', // classname
cartOverlay: '.js-ajax-cart-overlay', // classname
cartCounter: '.js-ajax-cart-counter', // classname
<!--ajax cart modal-->
<div class="ajax-cart__modal js-ajax-cart-modal">
<div class="ajax-cart-modal">
<!--ajax cart modal close-->
<div class="ajax-cart-modal__close js-ajax-cart-modal-close">
{% include 'icon-close' %}
</div>
<!--end ajax cart modal close-->