Skip to content

Instantly share code, notes, and snippets.

View serradura's full-sized avatar
🎯
Focusing

Rodrigo Serradura serradura

🎯
Focusing
View GitHub Profile
@serradura
serradura / meetup-artoo.js
Last active September 25, 2017 21:57
artoo.js meetup.com attendees scraper
// Dependency: https://medialab.github.io/artoo/
// Recommendation: Use the script with Google Chrome DevTools console.
let attendees;
attendees = $('.attendee-item').map(function(_index, attendee) {
const $attendee = $( attendee );
const $avatar = $attendee.find('a.avatar');
const image = $avatar.css('background-image').match(/"(.*)"/i)[1];
@serradura
serradura / html_element_reference.js
Created March 27, 2018 22:20
HTML Element Reference as a JSON/Javascript
/*
// https://www.w3schools.com/tags/default.asp
JSON.stringify(
Array.prototype.slice.call(
document.querySelectorAll('.w3-table-all tr')
)
.map(tr => tr.querySelector('td'))
.filter(n => !!n)
.map(n => n.innerText)
)
module LazyLogger
extend self
attr_accessor :output
def log(&callback)
@log_actions ||= []
@log_actions << callback
end
module Foo
A = 1
B = 2
def a1
A
end
def b1
B
@serradura
serradura / README.md
Last active April 21, 2022 19:33
Microtest - A xUnit family unit testing microframework for Ruby. (https://rubygems.org/gems/u-test)

µ-test (Microtest)

A xUnit family unit testing microframework for Ruby.

Prerequisites

Ruby >= 2.2.2

Installation

@serradura
serradura / README.md
Last active July 23, 2020 13:45
ORM (225 LOC and ~510 LOC of tests) - An Object-relational mapping implementation using only the Ruby standard library.
<!DOCTYPE html>
<html>
<head>
<title>jQuery.behavior</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<a href="01.html">01</a> | <a href="02.html">02</a> | <a href="03.html">03</a> | <a href="04.html">04</a> | <a href="05.html">05</a>
@serradura
serradura / README.md
Last active January 18, 2019 13:20
Simple authorization library and role managment for Ruby - https://rubygems.org/gems/u-authorization

µ-authorization

Simple authorization library and role managment for Ruby.

Prerequisites

Ruby >= 2.2.2

Installation

@serradura
serradura / example_1.rb
Last active October 19, 2018 16:37
Example of how to make APIs tests (end-to-end) using Ruby.
# Runtime dependency:
# gem install bundler --no-ri --no-rdoc
# How to run:
# ruby example_1.rb
require "bundler/inline"
gemfile do
source "https://rubygems.org"
@serradura
serradura / Rakefile
Last active December 18, 2018 15:34
Exemplo de rake task numa abordagem Procedural |> Funcional (Rubyconf Brasil 2018)
ArgAsNumber = -> (args) do
-> key { args[key].to_f }
end
CalculateTaskArgumentsWith = -> (operator) do
-> (task, args) do
arg_as_number = ArgAsNumber.(args)
puts [:a, :b].map(&arg_as_number).reduce(&operator)