Skip to content

Instantly share code, notes, and snippets.

View dvinciguerra's full-sized avatar
:octocat:
Bite my shine metal class!!!

Daniel Vinciguerra dvinciguerra

:octocat:
Bite my shine metal class!!!
View GitHub Profile
@dvinciguerra
dvinciguerra / .solargraph.yml
Created February 22, 2022 21:14
.solargraph.yml
---
include:
- "**/*.rb"
- Rakefile
- "**/*.rake"
- Gemfile
- "**/*.gemspec"
exclude:
- spec/**/*
- test/**/*
@dvinciguerra
dvinciguerra / rails.rb
Created February 17, 2022 21:10 — forked from castwide/rails.rb
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@dvinciguerra
dvinciguerra / cloudflare_update_ip.rb
Last active December 10, 2021 19:08
Ruby script to update Cloudflare IP address
#!ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'dotenv', require: 'dotenv/load'
gem 'cloudflare'
console.clear()
const specs = document.querySelectorAll('header > div')
let files = {}
specs.forEach((item) => {
const path = item.innerText
const isSpecPath = path.match(/^spec/)
if(isSpecPath) files[path] = (files[path] || 0) + 1
@dvinciguerra
dvinciguerra / up.sh
Last active September 2, 2021 18:05
up.sh - how I maintain my dotfiles
#!/bin/bash
set -e -o pipefail
# constants
ROOT_DIR="$(pwd)"
HOME_DIR="$HOME"
function create_directory {
local directory_path="$1"
@dvinciguerra
dvinciguerra / basic_with_containers.rb
Created August 20, 2021 22:38
Structurizr Ruby DSL that transpile to native Structurizr DSL
# frozen_string_literal: true
workspace do
system = nil
model do
user = person "User"
system = software_system "Software System" do
webapp = container "Web Application" do |webapp_container|
user.point_to webapp_container, label: "Uses"
@dvinciguerra
dvinciguerra / import_js_modules_to_devtools.js
Created August 17, 2021 22:24
Import JS Modules to Browser DevTools
(function (module) {
const script = document.createElement('script')
script.setAttribute('src', module)
document.body.appendChild(script)
}('https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'))
const name = ''
if (_.isEmpty(name)) console.log('name is empty!')
@dvinciguerra
dvinciguerra / rubyconf2021_chat_scroll_bottom.js
Created July 30, 2021 22:10
RubyConf 2021 Chat Scroll to Bottom
// colar no devtools e executar
const el = document.querySelector('.chat-scroll')
window.setInterval(function() {
el.scrollTop = el.scrollHeight
}, 50)
@dvinciguerra
dvinciguerra / free_games.rb
Last active June 8, 2021 01:03
Epic Games - Ruby script to fetch free games from website
require 'json'
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'faraday'
end
@dvinciguerra
dvinciguerra / gut.rb
Created March 12, 2021 20:40
My personal GUT calculation classes (label extraction support)
module GUT
extend self
MIN_CRITICAL_SCORE = 20
module ScoreFromLabels
def self.included(base)
base.extend(ClassMethods)
end