Skip to content

Instantly share code, notes, and snippets.

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

Terry Raimondo terry90

🏠
Working from home
  • GetPro
  • 02:22 (UTC +02:00)
View GitHub Profile
@terry90
terry90 / Dockerfile
Last active June 5, 2024 20:24
Rust Dockerfile to build really small containers with postgres and SSL (~20Mo with rocket and diesel). Dependencies are cached for faster builds.
FROM clux/muslrust as build
WORKDIR /app/
# Deps caching begins
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
@terry90
terry90 / application.rb
Last active April 25, 2016 12:17
Notification system (with mailer) for Rails 4
# SEE THE GEM https://github.com/terry90/user_notif
# config/application.rb
config.autoload_paths += %W(#{config.root}/app/models/notifications)
@drogus
drogus / Rakefile.rb
Created July 26, 2013 10:49
This is the example contents of the Rakefile, which you would use to run active record tasks without using Rails. It assumes using the same directories as rails uses: `db/migrate`, `config/database.yml`.
require 'bundler/setup'
require 'active_record'
include ActiveRecord::Tasks
db_dir = File.expand_path('../db', __FILE__)
config_dir = File.expand_path('../config', __FILE__)
DatabaseTasks.env = ENV['ENV'] || 'development'
@henrik
henrik / hash_deep_diff.rb
Created July 14, 2009 08:38
Recursively diff two Ruby hashes.
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {