See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| class UpsApiWorker | |
| include Sidekiq::Job | |
| sidekiq_options retry: 3 # Retry the job up to 3 times (adjust as needed) | |
| def perform(zipcode, batch) | |
| batch.jobs do | |
| UPS_API_LIMIT.within_limit do | |
| UpsApiService.fetch(zipcode) | |
| end |
| name: CI/CD | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| db: | |
| image: postgres:11 | |
| ports: ["5432:5432"] |
| - name: Generate deployment package | |
| run: | | |
| zip -r deploy.zip . -x '*.git*' | |
| - name: Deploy to EB | |
| uses: einaregilsson/beanstalk-deploy@v11 | |
| with: | |
| aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| application_name: testing-rails |
| branch-defaults: | |
| master: | |
| environment: staging | |
| group_suffix: null | |
| global: | |
| application_name: testing-rails | |
| branch: null | |
| default_ec2_keyname: xxxx | |
| default_platform: Puma with Ruby 2.6 running on 64bit Amazon Linux | |
| default_region: ap-south-1 |
| name: CI/CD | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| db: | |
| image: postgres:11 | |
| ports: ["5432:5432"] |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Setup Ruby | |
| uses: actions/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.6.x | |
| - uses: borales/[email protected] | |
| with: | |
| cmd: install | |
| - name: Build and run test |
| def self.export_data_to_csv | |
| headers = ["Zipcode", "Locality Type", "Locality Name", "State", "State Abbr", "Country"] | |
| Locality.all.grou_by(&:state_abbr).each do |state, records| | |
| file = File.new("public/#{state}.csv", "w") | |
| CSV.open(file, 'w', write_headers: true, headers: headers) do |writer| | |
| records.each do |locality| | |
| writer << [locality.zipcode, locality.locality_type, locality.name, locality.state, locality.state_abbr, locality.country] | |
| end |
| package test.kotlin | |
| import main.kotlin.WHBEvent | |
| import main.kotlin.WHBState | |
| import main.kotlin.WHBStateMachine | |
| import org.assertj.core.api.Assertions.assertThat | |
| import org.junit.jupiter.api.BeforeEach | |
| import org.junit.jupiter.api.DisplayName | |
| import org.junit.jupiter.api.Tag | |
| import org.junit.jupiter.api.Test |
| class WHBStateMachine { | |
| val whbStateMachine = StateMachine.create<WHBState, WHBEvent, WHBSideEffect> { | |
| initialState(WHBState.Bed) | |
| state<WHBState.Bed> { | |
| on<WHBEvent.Wake> { | |
| transitionTo(WHBState.Home, WHBSideEffect.LogWakeTime) | |
| } | |
| } | |