Skip to content

Instantly share code, notes, and snippets.

Avatar

Máximo Mussini ElMassimo

View GitHub Profile
@ElMassimo
ElMassimo / UrlHelper.js
Last active Jun 22, 2020
js_from_routes: Example on how to generate request helpers for jQuery instead of fetch or axios
View UrlHelper.js
import buildURL from 'axios/lib/helpers/buildURL'
import { deepDecamelizeKeys } from '@helpers/ObjectHelper'
import { snakeCase } from 'lodash'
const INTERPOLATION_PLACEHOLDER = /:[^\W\d]+/g
// Public: Replaces any placeholder in the string with the provided parameters.
function interpolate (template, params) {
let value = template.toString()
for (const paramName in params) {
@ElMassimo
ElMassimo / documentation_examples.md
Last active Feb 17, 2020
Documentation Examples
View documentation_examples.md

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 Feb 25, 2019
Banco Central del Uruguay - Billete Comprador Dólar Estadounidense - Última cotización anterior a la fecha
View cotizaciones_bcu.rb
#!/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 Oct 29, 2018
Capybara Test Helper - Snippet for Sublime Text
View capybara_test_helper.sublime-snippet
<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
View matcher.sublime-snippet
<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 Sep 7, 2017
Music Conversion (MP3 to WMA and WAV to MP3)
View convert_all
#!/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
View trailing_spaces_settings.json
{
"trailing_spaces_enabled": true,
"trailing_spaces_modified_lines_only": false,
"trailing_spaces_trim_on_save": true
}
@ElMassimo
ElMassimo / sublime_config.json
Last active Sep 10, 2018
Maximo's Sublime Config
View sublime_config.json
{
"always_show_minimap_viewport": true,
"auto_complete": false,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"draw_white_space": "none",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"font_face": "Fira Code",
"font_face": "Fira Code",
@ElMassimo
ElMassimo / decorated_bands_controller.rb
Created Apr 3, 2017
Rails CRUD Controller using Draper
View decorated_bands_controller.rb
class BandController < ApplicationController
def new
@band = Band.new.decorate
end
def create
@band = Band.new(band_params)
if @band.save
redirect_to(@band)
else
@ElMassimo
ElMassimo / bands_controller.rb
Last active Dec 21, 2017
Sample Rails CRUD Controller
View bands_controller.rb
class BandController < ApplicationController
def new
@band = Band.new
end
def create
@band = Band.new(band_params)
if @band.save
redirect_to(@band)
else
You can’t perform that action at this time.