Skip to content

Instantly share code, notes, and snippets.

@klzns
klzns / iFramePayment.js
Created Aug 15, 2016
Fechamento de compra com iFrame
View iFramePayment.js
function handleEvents(event) {
switch(event) {
// ...
case 'sendPayments.vtex':
let checkoutPayments = event.data.arguments[0];
let transactionResponse = event.data.arguments[1];
let deviceFingerprint = event.data.arguments[2];
sendPayments(checkoutPayments, transactionResponse, deviceFingerprint);
break;
}
View index.js
System.config({defaultJSExtensions: true});
System.config({
baseUrl: '/',
packages: {
'brenoc.theme@3.5.0': {
map: {
'vtex.sdk': 'vtex.sdk@1.0.0',
'n1.shelf': 'n1.shelf@0.7.1',
'vtex.banner': 'vtex.banner@1.0.0',
@klzns
klzns / iso-alpha-2-to-3.json
Last active Mar 16, 2016
Country Code ISO Alpha 2 to Country Code ISO Alpha 3
View iso-alpha-2-to-3.json
{
"AF": "AFG",
"AX": "ALA",
"AL": "ALB",
"DZ": "DZA",
"AS": "ASM",
"AD": "AND",
"AO": "AGO",
"AI": "AIA",
"AQ": "ATA",
@klzns
klzns / _index.js
Created Dec 21, 2015
ISO Alpha 3 to country name localized. Translated country names in Portuguese, spanish, french and english.
View _index.js
var fs = require('fs');
// Files
var files = [
'es',
'fr',
'pt-br',
'us'
];
@klzns
klzns / server.js
Last active Jan 31, 2016
How to proxy index.html with react-transform
View server.js
var express = require('express');
var webpack = require('webpack');
var httpProxy = require('http-proxy');
var proxy = new httpProxy.createProxyServer();
var config = require('./webpack.config');
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
@klzns
klzns / conemu-gitbash.md
Last active Sep 14, 2015
ConEmu & Git Bash
View conemu-gitbash.md

You can get to the settings by right-clicking the window bar (why this isn't on a [gear] icon is beyond me). If you want it to take over as the default command prompt, the option you want is under Integration > Default Term, its the first checkbox.

Now, to get the MySysGit Bash to open:

  1. Go to Startup > Tasks
  2. Hit the [+] Button to create a new task
  3. Give it a name
  4. Set the task parameters to /single /Dir "[YourStartupDir]" /icon "%ProgramFiles(x86)%\Git\etc\git.ico"
  5. Set the shell with the command
@klzns
klzns / setup.md
Last active Sep 14, 2015
Setup Storefront
View setup.md

Para o Alpha precisamos que o computador tenha algumas coisas instaladas. Caso não consiga instalar algo, podemos ver isso no dia.

Node

Instruções de como instalar o node.

Windows

Caso use o Windows, instale o Git Bash e o ConEmu eles facilitam o uso do terminal. Depois configure o ConEmu para usar o Git Bash (instruções)

Pacotes node

@klzns
klzns / gist:a8f83b0de7a899b61b06
Last active Aug 29, 2015
Como pegar a URL da imagem do produto
View gist:a8f83b0de7a899b61b06
let accountName = 'basedevmkp';
let width = 500;
let height = 500;
let path = imageUrl.replace('#width#', width).replace('#height#', width);
let baseUrl = `http://${accountName}.vteximg.com.br`
path = baseUrl + path;
@klzns
klzns / mac-and-ubuntu-node-install.sh
Last active Nov 18, 2015
Node install instructions
View mac-and-ubuntu-node-install.sh
#!/bin/bash
echo 'Installing node latest stable'
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
@klzns
klzns / ReactSVGWebpackExample.jsx
Last active Aug 29, 2015 — forked from MoOx/svgicon.css
Adding SVG icons with React + webpack
View ReactSVGWebpackExample.jsx
import React from 'react';
import SVGIcon from 'components/utils/SVGIcon';
import myIcon from 'assets/icons/myicon.svg';
class MyComponent extends React.Component {
render() {
return (
<div>
<SVGIcon svg={myIcon} width={18} height={18} fill="#444"/>
</div>