This file contains hidden or 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
HCL 33 mins βββββββββββββββββββββ 44.0% | |
Markdown 13 mins βββββββββββββββββββββ 17.3% | |
YAML 10 mins βββββββββββββββββββββ 13.7% | |
Ruby 10 mins βββββββββββββββββββββ 13.2% | |
Bash 8 mins βββββββββββββββββββββ 11.0% |
This file contains hidden or 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
class SendEmailJob < ActiveJob::Base | |
queue_as :default | |
def perform(body, email) | |
Mailer.send(body, email) | |
end | |
end |
This file contains hidden or 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
require 'rails_helper' | |
RSpec.describe SendEmailJob, type: :job do | |
let(:Mailer) { create(:Mailer) } | |
let(:email) { "[email protected]" } | |
let(:body) { "Hello World" } | |
it 'enqueues itself on default queue' do | |
ActiveJob::Base.queue_adapter = :test | |
expect { SendEmailJob.perform_async(email, body) } |
This file contains hidden or 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
# Adding columns as index | |
df.set_index('column_name') | |
# Dropping columns or rows | |
df.drop(['x1','x2'],axis = (1 or 0)) |
This file contains hidden or 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
# For one-hot encoding string categorical data | |
from numpy import array | |
from numpy import argmax | |
from sklearn.preprocessing import LabelEncoder | |
from sklearn.preprocessing import OneHotEncoder | |
# define example | |
data = ['cold', 'cold', 'warm', 'cold', 'hot', 'hot', 'warm', 'cold', 'warm', 'hot'] | |
values = array(data) | |
print(values) | |
# integer encode |