Skip to content

Instantly share code, notes, and snippets.

@mudhappy
mudhappy / Dockerfile.silicon
Created November 29, 2022 17:43
Dockerfile silicon
FROM ruby:2.7.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
# yarn
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1646B01B86E50310
RUN echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get update -qq \
@mudhappy
mudhappy / export.rb
Created November 25, 2020 17:27
Exportar info
packages = Package.actives.includes(:itineraries).includes(:activities);0
result = []
packages.each do |package|
res = []
res << package.name.gsub('|', '')
res << package.description.gsub('|', ' ').gsub(/\s+/, ' ').gsub('&nbsp;', ' ').squish
res << package.starting_point.gsub('|', ' ').gsub(/\s+/, ' ').gsub('&nbsp;', ' ').squish
res << package.includes.gsub('|', ' ').gsub(/\s+/, ' ').gsub('&nbsp;', ' ').squish
@mudhappy
mudhappy / download.rb
Created April 14, 2020 19:26
download images
get 'get_download' => "application#download"
def download
require "open-uri"
require 'fileutils'
tours = [
["421","https://www.graylinecostarica.com/uploads/tours/TOUC05-5.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-6.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-7.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-8.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-9.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-10.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-25.JPG,https://www.graylinecostarica.com/uploads/tours/TOUC05-26.JPG"],
]
@offline_sales = OfflineSale.where("cod_1 = ?", @offline_sale.cod_1).pluck(:id)
if @offline_sale.cod_1 && @offline_sales
@disaggregates = DisaggregatedOfflineSale.where(offline_sale_id: @offline_sales).order(:service)
else
@disaggregates = DisaggregatedOfflineSale.where(offline_sale_id: @offline_sale.id).order(:service)
end
@mudhappy
mudhappy / _index.html.slim
Created July 5, 2019 06:40
admin_panel disaggregated_offline_sales
div.agency_commission_info
.double-panel
div class="control-group float optional offline_sale_ti_commission"
label class="float optional control-label" for="offline_sale_ti_commission"
| Comisión Agencia (S/.)
.controls
input class="numeric float optional span12" step="any" type="number" value="#{@offline_sale.agency_commission}" readonly="true"
div class="control-group float optional offline_sale_ti_commission"
label class="float optional control-label" for="offline_sale_ti_commission"
| Comisión Agencia (US$)
@mudhappy
mudhappy / Scroll Top Jquery
Last active December 9, 2017 22:47
Scroll Top Jquery
$(function() {
$(".fa-angle-down").on("click", function()
{
let altura = $( window ).height();
$("html, body").animate({ scrollTop: altura }, "slow");
return false;
});
});