Skip to content

Instantly share code, notes, and snippets.

🎯
coding...

Gonzalo Moreno ronzalo

🎯
coding...
  • Desafio Latam
  • Santiago, Chile
Block or report user

Report or block ronzalo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ronzalo
ronzalo / diff.rb
Created Sep 2, 2019 — forked from ecleel/diff.rb
SequenceMatcher class in ruby. credit to testunit folks.
View diff.rb
# port of Python's difflib.
#
# Copyright (c) 2001-2008 Python Software Foundation; All Rights Reserved
# Copyright (c) 2008-2011 Kouhei Sutou; All Rights Reserved
#
# It is free software, and is distributed under the Ruby
# license and/or the PSF license. See the COPYING file and
# PSFL file.
# Carry this code from testunit/testunit project.
@ronzalo
ronzalo / slack_file_deleter.rb
Created Aug 3, 2018
Script to delete old files on slack
View slack_file_deleter.rb
# frozen_string_literal: true
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files(user = nil)
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
@ronzalo
ronzalo / Dockerfile
Created Jul 13, 2018 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
View Dockerfile
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@ronzalo
ronzalo / Dockerfile
Created Jun 26, 2018
Python Dockerfile for Autolab autograding image
View Dockerfile
# Autolab - autograding docker image
FROM ubuntu:18.04
MAINTAINER Gonzalo Moreno <gonzalo.m@desafiolatam.com>
RUN apt-get update --fix-missing
RUN apt-get install -y gcc
RUN apt-get install -y make
RUN apt-get install -y build-essential
RUN apt-get install -y python
@ronzalo
ronzalo / safe_merge.sh
Last active May 16, 2018 — forked from gonzalo-bulnes/safe_merge.sh
Some merging rules to make collaboration easier through repository order. Think of rebasing as updating the context in which you write your feature, see also: https://gonzalo-bulnes.github.io/blog/gardening_with_git/context-from-scratch.html
View safe_merge.sh
# safe merge
#
# merge the branch XXXXXXXX-add-example-feature into master
# make sure the feature is properly tested and
# doesn't break anything in its original context
git checkout XXXXXXXX-add-example-feature
rake # the test suite MUST NOT raise any error
# make sure your local copy of master is up-to-date
View Entity.php
<?php
/*
*
* (c) Gonzalo Moreno C. <goncab380<at>hotmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@ronzalo
ronzalo / paperclip_has_destroyable_file.rb
Created Oct 6, 2016 — forked from sunny/paperclip_has_destroyable_file.rb
Rails Initializer to add destroyable attachments with Paperclip
View paperclip_has_destroyable_file.rb
# encoding: UTF-8
class ActiveRecord::Base
# Class method to add destroyable paperclip attachments.
#
# Example:
# has_attached_file :image
# has_destroyable_file :image
# attr_accessible :image_delete
#
@ronzalo
ronzalo / _form.html.erb
Created Sep 6, 2016
Coupon input in Spree cart
View _form.html.erb
<!-- app/views/spree/orders/_form.html.erb -->
<%= order_form.text_field :coupon_code, :class => 'form-control', placeholder: Spree.t(:coupon_code) %>
@ronzalo
ronzalo / _property.html.erb
Created Jul 19, 2016
Spree promotion rule for properties
View _property.html.erb
<!-- admin/promotions/rules/_property.html.erb -->
<div class="panel-body">
<div class="form-group property_rule_property_id">
<%= label_tag "#{param_prefix}_property_id_string", Spree.t('property_rule.choose_property') %>
<%= select_tag "#{param_prefix}[preferred_property_id]", options_from_collection_for_select(Spree::Property.all, "id", "presentation", promotion_rule.preferred_property_id), class: 'select2' %>
<%= label_tag "#{param_prefix}_value_string", Spree.t('property_rule.insert_value') %>
<%= text_field_tag "#{param_prefix}[preferred_value]", promotion_rule.preferred_value, class: 'form-control' %>
</div>
</div>
@ronzalo
ronzalo / gist:27b01228ac13f2b7e3d8
Created Jun 3, 2015
Taxon importer for spree_importer_core
View gist:27b01228ac13f2b7e3d8
class Spree::TaxonImporter < Spree::ImporterCore::BaseImporter
# Load a file and the get data from each file row
#
# @params
# row => "Hombre > Vestuario > Chaquetas > Parkas"
def load_data(row:)
return unless row[0].present?
taxons = row[0].split(">").map!(&:strip)
process_taxons(taxons)
You can’t perform that action at this time.