Skip to content

Instantly share code, notes, and snippets.

View iridakos's full-sized avatar
🎯
Focusing

Lazarus Lazaridis iridakos

🎯
Focusing
View GitHub Profile
@datenwolf
datenwolf / b64op.c
Created April 3, 2018 18:06
Modified base64 variant that is order preserving
/*
Sorting order preserving base64 implementation.
Based on the original implementation of
picoweb / litheweb -- a web server and application framework
for resource constraint systems.
Copyright (C) 2012 - 2018 Wolfgang Draxinger
This program is free software; you can redistribute it and/or modify
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 17, 2024 01:21
Hyperlinks in Terminal Emulators
[alias]
#? = diff
a = help
ai = init
aixas = revert
alaks = mv
apan = rebase
diks = show
fer = clone
graps = commit
@pitpit
pitpit / mailcatcher-install.md
Last active November 21, 2022 04:45
Install Mailcatcher on OSX - works well with macOS Sierra High 10.12.X

05/25/2018: tested with macOS Sierra High 10.12.6

08/04/2020: added @mayesa's suggestion to fix an exception with EventMachine 08/04/2020: tested with macOS Catalina 10.15.5

Install MailCatcher:

brew install ruby
sudo gem install mailcatcher
@merqlove
merqlove / optimization.rake
Created January 9, 2015 13:55
PostgreSQL optimization tasks for ActiveRecord
namespace :optimization do
desc "Provide DB vacuum for production environment"
task :vacuum => :environment do
begin
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
end
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 19, 2024 18:25
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@runemadsen
runemadsen / description.markdown
Created September 26, 2011 15:23
Reverse polymorphic associations in Rails

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.

@zachwaugh
zachwaugh / gist:521133
Created August 12, 2010 15:19
Loading rails environment in a script
#!/usr/bin/env ruby
# Load Rails
ENV['RAILS_ENV'] = ARGV[0] || 'production'
DIR = File.dirname(__FILE__)
require DIR + '/../config/environment'
# ... do stuff that requires using your rails models