Skip to content

Instantly share code, notes, and snippets.

View grillermo's full-sized avatar
💭
Working to deliver magic!

Guillermo Siliceo grillermo

💭
Working to deliver magic!
View GitHub Profile
@grillermo
grillermo / request.json
Created November 9, 2021 22:53
Listo request
{
"folio": "A",
"issued_on": "2021-11-09T16:49:38",
"issued_at": "06600",
"series": "1",
"payment_form": "PUE",
"payment_method": "01",
"comments": "",
"currency": "MXN",
"exchange_rate": "1",
@grillermo
grillermo / response.json
Last active November 9, 2021 22:50
Respuesta API listo
{
"status": "ok",
"invoice": {
"id": 1511441,
"client_name": "PUBLICO EN GENERAL",
"currency": "MXN",
"total": 104.4,
"pdf": {
"url": "https://production-listo-mx.s3.amazonaws.com/generated_invoices/invoice.pdf",
"filename": "4142257A-AF94-4C7E-A097-C34B65A9B553.pdf"
@grillermo
grillermo / benchmark.rb
Created June 9, 2021 22:14
Ruby code benchmarking template using benchmark gem
require 'benchmark'
require 'launchy'
require 'ruby-prof'
reload!
def run
directory = Rails.root.join('tmp', 'profiles')
report_file = "#{directory}/benchmark.html"
FileUtils.mkdir_p directory
@grillermo
grillermo / SLEEP AND ADOLESCENCE
Created March 28, 2020 13:43
SLEEP AND ADOLESCENCE - Why We Sleep
SLEEP AND ADOLESCENCE
Why do we spend so much time in REM sleep in the womb and early in life, yet switch to a heavier dominance of deep NREM sleep in late childhood and early adolescence? If we quantify the intensity of the deep-sleep brainwaves, we see the very same pattern: a decline in REM-sleep intensity in the first year of life, yet an exponential rise in deep NREM sleep intensity in mid- and late childhood, hitting a peak just before puberty, and then damping back down. What’s so special about this type of deep sleep at this transitional time of life?
Prior to birth, and soon after, the challenge for development was to build and add vast numbers of neural highways and interconnections that become a fledgling brain. As we have discussed, REM sleep plays an essential role in this proliferation process, helping to populate brain neighborhoods with neural connectivity, and then activate those pathways with a healthy dose of informational bandwidth.
But since this first round of brain wiring is purposeful
@grillermo
grillermo / fast_experiment.rb
Created November 15, 2019 22:55 — forked from jonatas/fast_experiment.rb
Try to automated replace create for build_stubbed in specs
require 'rubygems'
require 'fast'
def nice_experiment_with(file)
parts = file.split('/')
dir = parts[0..-2]
filename = "experiment_#{parts[-1]}"
File.join(*dir, filename)
end
@grillermo
grillermo / app assets javascripts array_field.js
Last active March 8, 2022 17:10
rails admin array field with postgresql text array
//= require 'rails_admin/tagify.min'
$(function(){
var inputs = document.querySelectorAll('input.comma_array')
var inputs_array = [...inputs]
inputs_array.forEach(input => {
var input = new Tagify(input, {
originalInputValueFormat: valuesArr => valuesArr.map(item => item.value).join(',')
})
@grillermo
grillermo / app assets javascripts rails_admin actions create_aliada_working_hours.js
Created February 8, 2018 17:59
A complete rails admin custom action, the file of this gist are the paths were you should put your files
alert('omg hi!')
@grillermo
grillermo / not_removable_has_many_association.rb
Created March 9, 2017 17:04
A has many rails admin field with the remove association button gone.
require 'rails_admin/config/fields/association'
module RailsAdmin
module Config
module Fields
module Types
class NotRemovableHasManyAssociation < RailsAdmin::Config::
Fields::
Types::
HasManyAssociation
@grillermo
grillermo / scrape-facturify-with-artoo.js
Last active December 31, 2016 01:06
You can't export from all your companies in facturify and you cant scrape in automated fashion due to the captcha so you have to use a browser based scraper such artoo.js
aliadas_urls = [
{
url: 'https://client.facturify.com/models/multiempresa.php?type=defecto&id=12',
data: {
multi: 288, // ID of the company
},
},
]
artoo.ajaxSpider(
{
"username": "paulina@aliada.mx",
"password": "Facturify2016%",
"json": {
"emisor": {
"rfc": "AUDG920525111",
"receptor": {
"tipo_persona": "Persona Moral",
"rfc": "AEM130927BD7",
"RazonSocial": "APC EGS MX SA DE CV",