Skip to content

Instantly share code, notes, and snippets.

View ElMassimo's full-sized avatar
🎵

Máximo Mussini ElMassimo

🎵
View GitHub Profile
@ElMassimo
ElMassimo / vite.config.ts
Created February 27, 2023 22:32
How to configure resolve.alias by using paths in tsconfig.json
import { defineConfig, type AliasOptions } from 'vite'
import { readFileSync } from 'fs'
import { parse as parseJSON } from 'json5'
import { resolve } from 'path'
import { projectRoot } from 'vite-plugin-ruby'
/**
* Makes it possible to use shorter absolute path references, which are not
* ambiguous, and easier to refactor than relative paths.
*/
@ElMassimo
ElMassimo / 01_bookmark_create_spec.rb
Last active November 24, 2020 12:05
Ruby Yagi - Introduction to Rails testing with RSpec and Capybara - With Test Helpers
require 'rails_helper'
RSpec.describe 'create bookmark', type: :system, test_helpers: [:bookmarks] do
before { visit bookmarks_path }
scenario 'empty title and url' do
bookmarks.add(title: '', url: '')
bookmarks.should.have_error("Title can't be blank")
bookmarks.should_not.have_bookmark('Ruby Yagi')
end
@ElMassimo
ElMassimo / 01_obscure_spec.rb
Last active November 23, 2020 03:21
Chart Appointment Example
require 'rails_helper'
feature 'Update OCT data', js: true do
before do
create(:appointment_module_type, name: 'OCT')
appointment = create('schedule/appointment')
login_as(appointment.physician.user)
visit patient_chart_path(appointment.patient)
end
@ElMassimo
ElMassimo / VideoClipsRequests.js
Last active March 13, 2021 14:29
js_from_routes: Example on how to generate request helpers for jQuery instead of fetch or axios
// JsFromRoutes CacheKey 51392094fd67182442e4e49fb7820825
//
// DO NOT MODIFY: This file was automatically generated by JsFromRoutes.
import { formatUrl } from '@helpers/UrlHelper'
export default {
downloadPath: options =>
formatUrl('/video_clips/:id/download', options),
addToPlaylist: options =>
@ElMassimo
ElMassimo / documentation_examples.md
Last active February 17, 2020 16:50
Documentation Examples

We should document fields, properties, methods, classes, and anything that would benefit from additional information besides the code itself. The sweet spot is to write enough to provide a meaningful idea of the purpose, without going overboard and writing in too much detail or things that are too obvious.

For example, if the name of a parameter already hints the type and purpose, we shouldn't need to provide additional information about it.

Which format to use?

@ElMassimo
ElMassimo / cotizaciones_bcu.rb
Last active July 12, 2023 12:10
Banco Central del Uruguay - Billete Comprador Dólar Estadounidense - Última cotización anterior a la fecha
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'savon'
# Public: Permite obtener cotizaciones utilizando los webservices del BCU.
#
# Si se ejecuta como script pasandole un argumento, imprime la ultima cotizacion
# de compra del dolar billete anterior a la fecha:
# ./cotizaciones_bcu.rb 2019-02-18
@ElMassimo
ElMassimo / capybara_test_helper.sublime-snippet
Last active October 29, 2018 12:43
Capybara Test Helper - Snippet for Sublime Text
<snippet>
<content><![CDATA[
# frozen_string_literal: true
class $1TestHelper < CapybaraTestHelper
# Selectors: Semantic aliases for elements, a very useful abstraction.
SELECTORS = {$2}
# Getters: A convenient way to get related data or nested elements.
$3
<snippet>
<content><![CDATA[
import { createMatcher } from '@support/MatchersHelper'
export default createMatcher('${TM_FILEPATH/.*?(\w+).js/\1/}', {
// Selectors: Semantic aliases for elements, a very useful abstraction.
selectors: {$1
},
// Getters: A convenient way to get nested elements in the component.
getters: {$2
@ElMassimo
ElMassimo / convert_all
Created September 7, 2017 18:08
Music Conversion (MP3 to WMA and WAV to MP3)
#!/bin/bash
find . "(" -iname "*.mp3" ")" -print0 | xargs -0 -I file mv file "../music/$file"
find . "(" -iname "*.wma" ")" -print0 | xargs -0 -I file ./convert_file file
@ElMassimo
ElMassimo / trailing_spaces_settings.json
Created June 6, 2017 19:09
Trailing Spaces Settings
{
"trailing_spaces_enabled": true,
"trailing_spaces_modified_lines_only": false,
"trailing_spaces_trim_on_save": true
}