Skip to content

Instantly share code, notes, and snippets.

View kennethgeerts's full-sized avatar
🏠
Working from home

Kenneth Geerts kennethgeerts

🏠
Working from home
View GitHub Profile
@fractaledmind
fractaledmind / dbsnap.rake
Created September 14, 2023 11:18
A Rake namespace for working with local SQLite database snapshots
namespace :db do
namespace :snap do
task setup: :environment do
@snapshot_dir = Rails.root.join('storage/snapshots')
@db_path = ActiveRecord::Base.connection_db_config.database
@db_name = @db_path.rpartition('/').last.remove('.sqlite3')
end
task setup_snaps: :setup do
@snaps = Pathname(@snapshot_dir)
@elct9620
elct9620 / settings.rb
Created March 12, 2020 05:15
Simple settings model for Rails
# frozen_string_literal: true
require "singleton"
class Settings
include Singleton
class << self
delegate_missing_to :instance
end
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 11, 2024 21:37
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@mitsuru
mitsuru / aasmviz_controller.rb
Created November 23, 2017 06:54
Visualize aasm state diagram
class AasmvizController < ApplicationController
before_action :authenticate_account!
before_action :require_admin!
def index
Rails.application.eager_load!
@models = ActiveRecord::Base.descendants.select { |c| c.respond_to? :aasm }
end
def show
@subfuzion
subfuzion / curl.md
Last active July 16, 2024 16:18
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@iansltx
iansltx / _safari-iframe-cookie-workaround.md
Last active April 7, 2024 15:44
Safari iframe cookie workaround
@nrc
nrc / tools.md
Last active August 2, 2023 16:40
Rust tooling

Rust developer tools - status and strategy

Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.

In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an

@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call