Skip to content

Instantly share code, notes, and snippets.

View matiasleidemer's full-sized avatar

Matias H. Leidemer matiasleidemer

View GitHub Profile
@kirillshevch
kirillshevch / rails_new_options_help.md
Last active June 3, 2024 12:02
List of "rails new" options to generate a new Rails 7 application

Run rails new --help to see all of the options you can use to create a new Rails application:

Output for Rails 7+

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object
@mrmartineau
mrmartineau / stimulus.md
Last active July 18, 2024 07:43
Stimulus cheatsheet
@greigdp
greigdp / xps-9370.md
Created February 3, 2018 22:27
Dell XPS 13 (9370) Archlinux Install Notes

Install Notes - Dell XPS 13 (9370) 2018

The laptop works well on Archlinux. A few notes based on the installation guide for the previous version.

Intel GPU Power Saving

Per the Arch wiki, more power can be saved by creating /etc/modprobe.d/i915.confwith the following content:

options i915 modeset=1 enable_rc6=1 enable_fbc=1 enable_guc_loading=1 enable_guc_submission=1 enable_psr=1
@matheusazzi
matheusazzi / poker.ex
Last active July 20, 2017 17:12
poker.ex
defmodule Poker do
## Rank a poker hand
##
## Card is {:suit, value}, e.g. {:heart, 3}
## Hand is a list of 5 cards
##
## Poker.rank [{:heart, 10}, {:club, 11}, {:heart, 9}, {:diamond, 12}, {:heart, 13}]
## >> :straight
def rank(hand) do
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active July 14, 2024 12:33
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@caironoleto
caironoleto / apartment_setup_database_test.rake
Last active November 22, 2017 17:53
A faster way to deal with apartment in specs.
# This rake will setup the tenant like rails
# setup the test database.
Rake::Task['db:test:prepare'].enhance do
# Connect in the test database.
Rails.env = 'test'
ActiveRecord::Base.establish_connection('test')
Apartment::Tenant.drop('app') rescue nil
Apartment::Tenant.create('appp')
@searls
searls / market_research.rb
Last active September 18, 2018 03:21
Was chatting with @mfeathers about retaining Ruby's chained Enumerable style, but finding a way to inject names that reflects the application domain (as opposed to just littering functional operations everywhere, which may be seen as a sort of Primitive Obsession)
# A little toy file demonstrating how to build chainable
# data transformations that reveal some amount of intent
# through named extracted methods.
#
# Kudos to @mfeathers for giving me the idea to try this
#
# Copyright Test Double, LLC, 2016. All Rights Reserved.
require_relative "marketing_refinements"
set nocompatible " be iMproved, required
set number " shows line numbers
set relativenumber " show relative line numbers
set hlsearch " highlight search results
set cursorline " highlight cursor line
set laststatus=2 " this is needed for airline
set visualbell " no sounds
set colorcolumn=80 " column with 80
set wildmode=list " expand and folders/tabs when opening a file
set backspace=2 " makes backspace work as it should work
@Tapped
Tapped / uninstall_fuse.sh
Last active July 17, 2023 10:16
Uninstall Fuse
#!/bin/sh
# Call this script as root to fully remove Fuse
# For example: 'sudo ./uninstall_fuse.sh'
rm -rvf \
/Applications/Fuse.app \
/usr/local/bin/fuse \
/usr/local/bin/uno \
/usr/local/bin/unotest \