Skip to content

Instantly share code, notes, and snippets.

@kannangce
kannangce / FeignSSLUtils.java
Last active April 3, 2024 09:11
Feign client for 1 or 2-way TLS with self signed certificates when javax.net.ssl.keyStore / javax.net.ssl.trustStore cannot be overridden.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.AccessController;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
@simonw
simonw / how-to-upgrade-heroku-postgresql.md
Last active January 10, 2024 00:16
How to upgrade a Heroku PostgreSQL database to a new plan

How to upgrade a Heroku PostgreSQL database to a new plan

I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).

After assigning the new database, I had two databases attached to the application. They looked something like this:

  • HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database
@jacksonpires
jacksonpires / bootbox-rails.js
Created October 12, 2016 19:31
Sobrescreve o data-confirm do Rails pelo bootbox.js
$.rails.allowAction = function(element) {
var message = element.attr('data-confirm');
if (!message) { return true; }
var opts = {
title: "Confirmação",
message: message,
buttons: {
confirm: {
label: 'Sim',
@sirkkalap
sirkkalap / Install-Docker-on-Linux-Mint.sh
Last active December 8, 2022 18:38
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@mynameispj
mynameispj / application_helper.rb
Created June 2, 2013 00:24
Rails - Easy "active" classes for menu links in Rails
module ApplicationHelper
def current_class?(test_path)
return 'active' if request.path == test_path
''
end
end
@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@leommoore
leommoore / font-Awesome.markdown
Last active October 13, 2017 03:30
Using Font-Awesome with Rails 3.1 using CSS

#Using Font-Awesome with Rails 3.1 using CSS

  1. Download font-awesome from https://github.com/FortAwesome/Font-Awesome

  2. Put the font folder in the app/assets. I renamed the folder from font to fonts to make it clearer

  3. Add config.assets.paths << "#{Rails.root}/app/assets/fonts" to config/application.rb. This is to include the apps/assets/fonts folder in the asset pipeline

  4. Put the font-awesome.css file in the app/assets/stylesheets folder