Skip to content

Instantly share code, notes, and snippets.

View rodriguezartav's full-sized avatar

Roberto Rodriguez rodriguezartav

View GitHub Profile
{
stats: [
{text: "Aumento Precio Coca" , stat: "+69%" },
{text: "Muertos en 4 Estados" , stat: "59%", details: "<p>Chihuahua 21%</p><p>Sinaloa 14%</p><p>Guererro: 10%</p><p>Durango 7%</p>"},
<html>
<head>
</head>
<body id="_3vot_<%= @app_name %>" class="_3vot">
<script src="<%= @serverTag %>/3vot.js"></script>
</body>
@rodriguezartav
rodriguezartav / gist:8ee0913c2a81f859df5f
Created July 10, 2014 16:05
Get unique attributes from data items
var productos = Producto.all();
var marcas = [];
for (var i = productos.length - 1; i >= 0; i--) {
var marca = productos[i].marca;
if(marcas.indexOf(marca) == -1 ) marcas.push(marca);
}
@rodriguezartav
rodriguezartav / gist:d54a3d90f467a650c049
Created July 11, 2014 16:18
3VOT Transform from Angular
var _3vot = require("3vot/utils")
var WalkDir = require("3vot-cli/node_modules/3vot-cloud/utils/walk");
var Path = require("path")
var fs = require("fs")
var rimraf = require("rimraf")
var $ = require('cheerio')
var fs = require('fs')
var _3Model = require("3vot-model")
var Ajax = require("3vot-model/lib/3vot-model-vfr-sfc");
Account = _3Model.setup("Account", ["Name"]);
Account.ajax = Ajax;
module.exports= Account
SALESFORCE_CLIENT_ID=
SALESFORCE_CLIENT_SECRET=
SALESFORCE_REDIRECT_URL=http://localhost:5000/login/callback
NODE_ENV=development
DEBUG=development
ORIGINS=localhost:5000
@rodriguezartav
rodriguezartav / gist:6ab902a63262d94c514a
Created February 28, 2015 17:15
Script para crear SubfamiliaVentas__c
List<Producto__c> productos = [select FamiliaNombre__c, Familia__c, Subfamilia__c, SubfamiliaVentas__c from Producto__c where Activo__c= true];
for( Producto__c producto : productos ){
Set<String> familias = new Set<String>{ '55' };
if( producto.FamiliaNombre__c=='Yale' && familias.contains( producto.Subfamilia__c ) ){
producto.SubfamiliaVentas__c = 'Digital';
}
}
@rodriguezartav
rodriguezartav / haml-mongo-application.rb
Created October 13, 2011 18:22
config/application.rb snippet for Haml and Mongomapper used by Rails Generators
#this goes in config/application.rb
#just before the closing "end" tag
#it tels rails generators to use Haml and Mongomapper
config.generators do |g|
g.orm :mongo_mapper # :active_record
g.template_engine :haml
g.stylesheet_engine = :sass
g.test_framework :rspec, :fixture => true, :views => false
end
@rodriguezartav
rodriguezartav / mongo.rb
Created October 13, 2011 18:25
config/initializers/mongo.rb it setups mongomapper to be used locally and in heroku with MongoHQ
MongoMapper.config = {
Rails.env => { 'uri' => ENV['MONGOHQ_URL'] ||
"mongodb://localhost/rubyconf_simple_app-#{Rails.env}-1" } }
MongoMapper.connect(Rails.env)
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connect if forked
end
@rodriguezartav
rodriguezartav / stitch.rb
Created October 13, 2011 18:26
config/initializers/stitch.rb it setups stitch to compile and include javascript applications templates in the main app file
class TmplCompiler < Stitch::Compiler
extensions :tmpl
def compile(path)
content = File.read(path)
%{var template = jQuery.template(#{content.to_json});
module.exports = (function(data){ return jQuery.tmpl(template, data); });}
end
end