Skip to content

Instantly share code, notes, and snippets.

View LukasPol's full-sized avatar

Lukas Pol Dos Santos Paes LukasPol

View GitHub Profile
@LukasPol
LukasPol / javascript.js
Created May 15, 2023 12:56 — forked from chaintng/javascript.js
Encryption Decryption Javascript and Ruby
// IDEA FROM: https://stackoverflow.com/questions/33929712/crypto-in-nodejs-and-ruby
var crypto = require('crypto'),
algorithm = 'aes-256-cbc',
key = 'SOME_RANDOM_KEY_32_CHR_123456789', // 32 Characters
iv = "0000000000000000"; // 16 Characters
function encrypt(text){
var cipher = crypto.createCipheriv(algorithm,key,iv)
var crypted = cipher.update(text,'utf-8',"base64")
@LukasPol
LukasPol / index.rb
Created October 24, 2022 18:35
radio e checkbox
# simple form
config.wrappers :totem_radio_and_checkboxes, tag: :fieldset, class: '', :error_class => 'error' do |b|
b.use :html5
b.use :label, class: 'font-medium text-lg mb-1'
b.wrapper :tag => 'div', :class => 'mt-1' do |ba|
ba.use :input, :class => 'input_radio_checkbox'
end
b.use :hint, wrap_with: { tag: :p }
b.use :error, wrap_with: { tag: :p, class: 'text-red-600' }
require 'csv'
file = CSV.read('arq.csv', headers: true, col_sep: ';')
stocks = file['Produto'].uniq.sort
receives = {
'dividendo': [],
'jcp': []
}
@LukasPol
LukasPol / pt-BR.yml
Created August 19, 2020 17:04
pt-BR translations for rails_admin
# translations for rails_admin
pt-BR:
datetime:
distance_in_words:
x_days:
one: "1 dias"
other: "%{count} dias"
activerecord:
models:
@LukasPol
LukasPol / Dockerfile
Last active November 8, 2021 18:42
docker Rails + postgres
FROM ruby:2.7.2
RUN apt-get update -yqq && apt-get install -y build-essential libpq-dev nodejs
## install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y yarn && rm -rf /var/lib/apt/lists/*
RUN mkdir /myapp