Skip to content

Instantly share code, notes, and snippets.

View UpperCod's full-sized avatar
🏠
Working from home

Matias Trujillo UpperCod

🏠
Working from home
View GitHub Profile
@UpperCod
UpperCod / codigo.js
Created April 27, 2022 14:37
test sodimac
/*Se quiere realizar un AB Testing en el sitio de Chile respecto al despliegue del cuadro "Resumen de tu compra", en donde se busca mostrar, cuando corresponda, la línea de "Ahorro Internet". Uno de nuestros programadores ya diseñó una solución, pero esta tiene algunos defectos:
1- El despliegue de la etiqueta no está en el formato correcto (-$XX.XXX.XXX)
2- El "Sub-total" debe reflejar el valor total del carro, sin ningún tipo de descuento
3- El "Ahorro con CMR" debe incluir tanto los descuentos asociados a la tarjeta, como los descuentos de internet
4- Se requiere que cada vez que el carro cambie (cantidades de productos, nuevos productos, etc.) también lo hagan todos los valores del resumen
Necesitamos que nos ayudes a solucionar estas deficiencias en el código para poder seguir con el AB Test. Para llevar esto a cabo y realizar las pruebas respectivas te sugerimos utilizar el módulo de "Agregar productos por código" existente en la página del carro de compras,
y agregar los sku 555212-5, 160305-1, 8739
[
{
"id": 38831,
"name": "Ucon Acrobatics Unisex Hajo Backpack, Olive Green",
"asin": "B06XRYRG4T",
"postings_count": 366,
"comments_count": 0,
"available": true,
"editors_note": "",
"prime": false,
@UpperCod
UpperCod / atomico-title-1.svg
Last active January 2, 2022 02:20
Atomico readme
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@UpperCod
UpperCod / 1-component-props.jsx
Last active February 11, 2021 03:33
Reative properties
import { c } from "atomico;
function component() {
return <host></host>;
}
component.props = {
value: String,
checked: {
type: Boolean,
@UpperCod
UpperCod / component-counter.jsx
Last active April 15, 2021 04:10
Functional behavior
import { useCounter } from "./use-counter.js";
function component() {
const count = useCounter("count");
return (
<host>
<button onclick={count.increment}>+</button>
<strong>{count.value}</strong>
<button onclick={count.decrement}>-</button>
</host>
@UpperCod
UpperCod / example-host.jsx
Last active February 11, 2021 03:02
designed for webcomponents
function component() {
const sayHello = () => {
console.log("hi!");
};
const handlerClick = () => {
console.log("click");
};
return (
@UpperCod
UpperCod / hello.js
Last active January 15, 2023 22:36
atomico-example
import { c, html } from "atomico"; // 3.0kB
function component({ name }) {
return html`<host shadowDom>Hello, ${name}</host>`;
}
component.props = {
name: String,
};
const add = (list) => (rule) => list.push(rule) && "";
const cssBlock = /([^}{;]*){([^}{]+)}/;
function parse(css) {
let blocks = [];
let current;
while(current = css.match(cssBlock)){
const [fragment,selector,content] = current;
const [spaces] = selector.match(/^ */);
const { index: start } = current;
const { length } = fragment;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@UpperCod
UpperCod / get-block-css.ts
Created October 4, 2020 15:54
capture the css blocks, great to use with sheet.insertRule
const add = (list: string[]) => (rule: string) => list.push(rule) && "";
function parse(css: string) {
const rules = [];
const atRules = [];
css
.replace(/\s+/g, " ")
.replace(/@([^{]+)\{(.*?}) *}/g, add(atRules))
.replace(/([^}{;]*){([^}{]+)}/g, add(rules));