<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Zarar Siddiqi</title>
    <description>The latest articles on Forem by Zarar Siddiqi (@arsenalist).</description>
    <link>https://forem.com/arsenalist</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F199995%2Fb131a7c8-9c6f-4f1e-9143-a242fb765ed8.jpeg</url>
      <title>Forem: Zarar Siddiqi</title>
      <link>https://forem.com/arsenalist</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/arsenalist"/>
    <language>en</language>
    <item>
      <title>How to update Stripe destination payments</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Tue, 18 Jul 2023 01:41:07 +0000</pubDate>
      <link>https://forem.com/arsenalist/how-to-update-stripe-destination-payments-5d88</link>
      <guid>https://forem.com/arsenalist/how-to-update-stripe-destination-payments-5d88</guid>
      <description>&lt;p&gt;&lt;code&gt;&lt;br&gt;
await this.stripe.charges.update(&lt;br&gt;
   transfer.destination_payment,&lt;br&gt;
   { description: event.title },&lt;br&gt;
   { stripeAccount: transfer.destination }&lt;br&gt;
);&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;They key is to pass in the destination Stripe account as part of the header, which you can do like so in NodeJS/JavaScript.&lt;/p&gt;

</description>
      <category>stripe</category>
    </item>
    <item>
      <title>The virtuous cycle of CI/CD</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Thu, 09 Apr 2020 06:09:26 +0000</pubDate>
      <link>https://forem.com/arsenalist/the-virtuous-cycle-of-ci-cd-32ck</link>
      <guid>https://forem.com/arsenalist/the-virtuous-cycle-of-ci-cd-32ck</guid>
      <description>&lt;p&gt;From &lt;a href="https://landing.google.com/sre/workbook/chapters/canarying-releases/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JfT1Q-fc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t20x6amdgqgzyw1nlogk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JfT1Q-fc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t20x6amdgqgzyw1nlogk.png" alt="The virtuous cycle of CI/CD"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>sre</category>
    </item>
    <item>
      <title>Starting and stopping a Kafka listener after Spring Boot Startup</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Sat, 04 Apr 2020 07:06:25 +0000</pubDate>
      <link>https://forem.com/arsenalist/starting-and-stopping-a-kafka-listener-after-spring-boot-startup-459g</link>
      <guid>https://forem.com/arsenalist/starting-and-stopping-a-kafka-listener-after-spring-boot-startup-459g</guid>
      <description>&lt;p&gt;The example's &lt;a href="https://github.com/Arsenalist/spring-kafka-listener-on-off-example"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The relevant bit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    @Autowired
    private KafkaListenerEndpointRegistry kafkaListenerEndpointRegistry;

    public String start() {
        MessageListenerContainer listenerContainer = kafkaListenerEndpointRegistry.getListenerContainer("fooGroup");
        listenerContainer.start();
        ...
    }

    @KafkaListener(id = "fooGroup", topics = "topic1", autoStartup = "false")
    public void listen(Foo2 foo) {
        ...
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>kafka</category>
      <category>spring</category>
      <category>java</category>
    </item>
    <item>
      <title>Easiest way to revert to previous commit without committing</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Thu, 02 Apr 2020 18:45:12 +0000</pubDate>
      <link>https://forem.com/arsenalist/easiest-way-to-revert-to-previous-commit-5g56</link>
      <guid>https://forem.com/arsenalist/easiest-way-to-revert-to-previous-commit-5g56</guid>
      <description>&lt;p&gt;From this &lt;a href="https://stackoverflow.com/a/21718540/529801"&gt;answer&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git revert --no-commit 0766c053..HEAD
git commit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Mockito: Passing in any() and a literal to the same method</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Sat, 21 Mar 2020 05:41:45 +0000</pubDate>
      <link>https://forem.com/arsenalist/mockito-passing-in-any-and-a-literal-to-the-same-method-3god</link>
      <guid>https://forem.com/arsenalist/mockito-passing-in-any-and-a-literal-to-the-same-method-3god</guid>
      <description>&lt;p&gt;Mockito has a restriction where when using &lt;code&gt;Mockito.when(someMethod(...))&lt;/code&gt; you can't pass in a combination of &lt;code&gt;any()&lt;/code&gt; and literal values to &lt;code&gt;someMethod()&lt;/code&gt;.It complains that we have to pick one. So, the following is illegal:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Solution 1 (preferred and as shown by Stephen):&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Mockito.when(context.configFileProvider(eq("file1"), any())).thenReturn("file1_contents")&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Solution 2 (works but ugly and the original post here):&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mockito.when(context.configFileProvider("file1", any())).thenReturn("file1_contents")
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There is a way around it which I stumbled upon when trying to test nested closures while writing Groovy scripts for Jenkins (don't ask me). Here it is:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Mockito.when(context.configFileProvider(Mockito.any(), Mockito.any())).thenAnswer(
        new Answer&amp;lt;String&amp;gt;(){
            @Override
            String answer(InvocationOnMock invocation){
                List arg1 = invocation.getArgument(0)
                switch (arg1.get(0)) {
                    case "file1": return "file1_contents"
                }
            }
        }
    );
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is logically equivalent to the previous statement.&lt;/p&gt;

</description>
      <category>java</category>
      <category>mockito</category>
      <category>testing</category>
      <category>groovy</category>
    </item>
    <item>
      <title>Find out what AD groups you're in on a Mac</title>
      <dc:creator>Zarar Siddiqi</dc:creator>
      <pubDate>Mon, 16 Mar 2020 13:22:25 +0000</pubDate>
      <link>https://forem.com/arsenalist/find-out-what-ad-groups-you-re-in-on-a-mac-5d6l</link>
      <guid>https://forem.com/arsenalist/find-out-what-ad-groups-you-re-in-on-a-mac-5d6l</guid>
      <description>&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id -Gn YOUR_EMPLOYEE_ID | sed $'s/ /\\\n/g' | sort
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>ios</category>
      <category>ad</category>
      <category>mac</category>
    </item>
  </channel>
</rss>
