This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/utils/sendmail_staging.rb | |
class SendmailStaging < ::Mail::Sendmail | |
# mail object can be used to modify mail before we pass it | |
# to sendmail | |
def deliver!(mail) | |
mail['to'] = 'yourmail@yourcompany.com' #replace recipient | |
super(mail) #Let Sendmail do his work | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Dudu query: | |
select part_id,produced_at | |
from (select part_id,produced_at | |
,dense_rank () over (partition by part_id order by produced_at) as dr | |
from part_subhourly_data | |
where produced_at < now() - interval '100 days' | |
) p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SASS variable overrides must be declared before loading up Active Admin's styles. | |
// | |
// To view the variables that Active Admin provides, take a look at | |
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the | |
// Active Admin source. | |
// | |
// For example, to change the sidebar width: | |
// $sidebar-width: 242px; | |
$primary-color: dynamic_active_admin_color(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branches_to_test=('master' 'staging' 'develop') | |
branch=`git rev-parse --abbrev-ref HEAD` | |
test_branch () { | |
local e | |
for e in "${branches_to_test[@]}" | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JENKINS_PATH=/usr/share/jenkins | |
echo -n "Removing old jenkins.war backcups ... " | |
rm -rf $JENKINS_PATH/jenkins.war.*.bkp | |
echo "Done" | |
echo -n "Backing up the current jenkins.war file ... " | |
cp $JENKINS_PATH/jenkins.war $JENKINS_PATH/jenkins.war.$(date +"%Y%m%d").bkp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wrapper to mock.verify procedure when asserting | |
# a method is called in minitest | |
class Object | |
def must_call(method_name, returns: nil, arguments: []) | |
mock = Minitest::Mock.new | |
mock.expect(:call, returns, arguments) | |
self.stub(method_name, mock) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fail script if a command fails | |
set -x | |
# Grab the latest postgresql:9.4-alpine image | |
docker pull postgres:9.4-alpine | |
# We will name our container as `pg_tmp`, so we will | |
# make sure that no container with this name is running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register MyModel do | |
# .. | |
# Configura essa página do active admin para utilizar batch actions | |
config.batch_actions = true | |
# Remove a action destory em batch (Você pode controlar outras coisas por aqui) | |
batch_action :destroy, false | |
# Cria a action export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
url = "http://data.fixer.io/api/latest?access_key=${ENV['FIXER_API_KEY']}&symbols=BRL" | |
response = Net::HTTP.get(URI(url)) | |
body = JSON.parse(response) | |
rate = body['rates'] && body['rates']['BRL'] # sometimes I work with ruby 2.2 which doesnt have dig =( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
# Update the system | |
sudo apt -y update && sudo apt -y upgrade | |
# Make GRUB remeber the last chosen entry | |
function grub_set_remeber_last_option () { | |
grub_file=/etc/default/grub |