Skip to content

Instantly share code, notes, and snippets.

View MatheusRich's full-sized avatar
🤔
Always learning, always changing

Matheus Richard MatheusRich

🤔
Always learning, always changing
View GitHub Profile
@kamilogorek
kamilogorek / _screenshot.md
Last active May 27, 2024 12:50
Clutter-free VS Code Setup
image
@baweaver
baweaver / proc_ast_sql.rb
Created February 3, 2022 09:56
Proc to AST applied to potential foundation for SQL hackery
require 'proc_to_ast'
def where(&fn)
ast = fn.to_ast
source = fn.to_source
pp ast:, source:
end
where { age > 18 && occupation.downcase == 'plumber' }
@JoshCheek
JoshCheek / tetris
Last active November 4, 2022 18:58
CLI tetris
#!/usr/bin/env ruby
require 'io/console'
class Grid
def self.from_str(str, color:)
rows = str.lines.map do |line|
line.chomp.chars.map do |c|
color if c != " ".freeze
end
end
@ndbroadbent
ndbroadbent / Gemfile
Last active December 11, 2021 22:31
How to get accurate SimpleCov coverage with Spring in a Rails application
group :development, :test do
gem 'spring-commands-rspec', require: false
gem 'spring-watcher-listen', require: false
gem 'spring', require: false
# ...
end
@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

@htr3n
htr3n / gulpfile.js
Last active October 31, 2021 23:36
Gulp 4 configuration SASS, PostCSS, autoprefixer, cssnano, sourcemaps
const gulp = require('gulp');
const sass = require('gulp-sass');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const sourcemaps = require('gulp-sourcemaps');
const log = require('fancy-log');
const sassSourceFile = 'assets/scss/hyde-hyde.scss';
const outputFolder = 'static/css';
@scmx
scmx / capybara-selenium-webdriver-slow-speed.md
Created May 5, 2018 07:46
Capybara Selenium WebDriver running at a lower speed using sleep command #capybara #selenium #rails #

Capybara Selenium WebDriver running at a lower speed using sleep command

Ever wanted to run your integration/end-to-end test suite at a lower speed so that you better could observe what's happening and perhaps make a recording of it?

Here's a a technique I've been using when writing tests with Capybara Selenium WebDriver.

Put this in test/test_helper.rb or maybe something like spec/support/capybara.rb.

@MatheusRich
MatheusRich / git-cagate.sh
Last active May 22, 2020 00:07
A simple bash script that creates a custom git command to ignore ALL kinds modifications (untracked files, modified files etc)
#!/bin/bash
# A simple bash script that creates a custom git command to ignore ALL kinds of
# modifications (untracked files, modified files, etc)
# Installation: run `sudo sh git-cagate.sh`
# Usage: run `git cagate` to ignore ALL modifications
cd /bin/ || exit
touch git-cagate
echo "touch .empty" >> git-cagate
@lpil
lpil / result.rb
Created April 13, 2017 11:21
Ruby Result Monad
require 'result/ok'
require 'result/error'
#
# A generic representation of success and failure.
#
# Styled after the Result monad of Elm and Rust
# (or the Either monad of Haskell).
#
# The `#and_then` method can be used to chain functions that
@tristang
tristang / open_struct_struct_hash.rb
Created September 2, 2016 13:50
OpenStruct vs Struct vs Hash performance
require 'benchmark'
require 'ostruct'
REP = 1000000
User = Struct.new(:name, :age)
USER = "User".freeze
AGE = 21
HASH = {:name => USER, :age => AGE}.freeze