Skip to content

Instantly share code, notes, and snippets.

View candidosales's full-sized avatar
🏠
Focusing

Candido Sales Gomes candidosales

🏠
Focusing
View GitHub Profile
export default function productList(products) {
const element = document.getElementById('product-list');
// map of products
let productItem = products.map(product => `
<div class="product-item">
<h1 class="product-title">${product.productVariants[0].title}</h1>
<img class="product-image" src="${product.productVariants[0].imageUrl}" alt="${product.productVariants[0].title}">
<p class="product-price">${product.productVariants[0].price}</p>
@candidosales
candidosales / custom-material.module.ts
Created September 29, 2017 14:32
Custom material Module
import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatSnackBarModule,
MatCardModule,
MatInputModule,
MatCheckboxModule,
MatIconModule,
MatSidenavModule,
MatSelectModule,
Verifying that "candidosales.id" is my Blockstack ID. https://onename.com/candidosales
@candidosales
candidosales / nginx.conf
Created April 30, 2017 18:42
NGINX Docker + Website static + Performance + Security
user nginx;
# PERFORMANCE
# https://gist.github.com/denji/8359866
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically
# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;
@candidosales
candidosales / update_products.rake
Last active August 4, 2016 18:04
[Rake task] Atualizar adicionando uma descrição nos produtos do Spree - Incluir o arquivo na pasta lib/tasks do seu projeto
namespace :update_products do
desc "update_products"
task :description => :environment do
skus = ["ABR112803","ABR112903","ABR112703","ABR101703","ABR101903","ABR102303","ABR109203","ABR113403","ABR112806","ABR100803","ABR10103","ABR112906","ABR113003","ABR113103","ABR100903","ABR101303","ABR101403","ABR101503","ABR102103","ABR109003","ABR112503","ABR113203","ABR89603","ABR84703","ABR102506","ABR112706","ABR101706","ABR101906","ABR102306","ABR109206","ABR113406","ABR112812","ABR100806","ABR112912","ABR113006","ABR113106","ABR100906","ABR101006","ABR101306","ABR101406","ABR101506","ABR102106","ABR10906","ABR112506","ABR113206","ABR89606","ABR84706","ABR89303","ABR102512","ABR10003","ABR112712","ABR101912","ABR102312","ABR105503","ABR109212","ABR113412","ABR100812","ABR113012","ABR113112","ABR101012","ABR101312","ABR101512","ABR102112","ABR109012","ABR112512","ABR113212","ABR101712","ABR88303","ABR100912","ABR89612","ABR101412","ABR84712","ABR89306","ABR100006","ABR105506","ABR88306","ABR89312","ABR1000
@candidosales
candidosales / main.js
Last active January 2, 2016 01:49
aura_components/product/main.js
define(['text!./template.html'], function(tpl) {
var template = _.template(tpl);
return {
initialize: function() {
this.render();
this.attachEvents();
this.sandbox.on('product.start', this.render, this);
this.sandbox.on('product.changePrice',this.changePrice, this);
this.sandbox.on('product.calculate',this.calculate, this);
@candidosales
candidosales / template.html
Created January 3, 2014 04:37
aura_components/product/template.html
<div class="product">
<div class="small-1 columns">
<a href="#" class="button minus" title="Remover">
<span class="icon-minus"></span>
</a>
</div>
<div class="small-10 columns">
<div class="small-6 columns">
<dl class="tabs" data-tab>
<dd class="active"><a href="#panel2-1">GLP</a></dd>
@candidosales
candidosales / Gruntfile.js
Last active December 19, 2015 08:59
Cria uma pasta dist, onde conterá todos os arquivos essenciais para produção. 1. Limpar dist; 2. Compila LESS; 3.1 Ler o index.html onde encontrar a posição e ordem dos CSS e JS, já configurando-os para concatenar e minificar; 4. Comprimir imagens e jogar na pasta dist; 5. Concatenar css, js; 6. Minificar css concatenado e jogar na pasta dist; 7…
/*global module:false*/
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
function isPrime(n) {
if (n%1 || n<2) return false;
if (n%2==0) return (n==2);
var m=Math.sqrt(n);
for (var i=3;i<=m;i+=2) {
if (n%i==0) return false;
}
return true;
}
@candidosales
candidosales / Gruntfile.js
Created June 14, 2013 03:45
Tutorial de grunt.js
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +