<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eileen on Medium]]></title>
        <description><![CDATA[Stories by Eileen on Medium]]></description>
        <link>https://medium.com/@eileenzhong?source=rss-7c64023ae0a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bqwYXTVX05KqpyTaa34cuw.jpeg</url>
            <title>Stories by Eileen on Medium</title>
            <link>https://medium.com/@eileenzhong?source=rss-7c64023ae0a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 26 May 2026 19:49:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eileenzhong/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Text Yourself the NASA Picture of the Day with Standard Library and Node.js]]></title>
            <link>https://medium.com/hackernoon/text-yourself-the-nasa-picture-of-the-day-with-standard-library-and-node-js-226f6ca48adc?source=rss-7c64023ae0a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/226f6ca48adc</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eileen]]></dc:creator>
            <pubDate>Thu, 18 Oct 2018 07:00:10 GMT</pubDate>
            <atom:updated>2018-11-29T05:29:46.190Z</atom:updated>
            <content:encoded><![CDATA[<h3>Text Yourself the NASA Picture of the Day With Standard Library and Node.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*aUCLxxSlMh5V_aGH.jpg" /><figcaption><strong>The APoD for 10/16/2018</strong>: Jupiter in Ultraviolet from Hubble</figcaption></figure><blockquote><strong>Me</strong>: The sky is not the limit ☁️</blockquote><blockquote><strong>Stranger</strong>: Pics or I don’t believe you <em>🙄</em></blockquote><p>Based on the above conversation, I’m going to show you how to get NASA’s highly coveted <strong>Astronomy Picture of the Day</strong> (APoD) with <a href="https://www.stdlib.com">Standard Library</a> 🌑 ⭐️</p><p>If you’re not familiar with <a href="https://www.stdlib.com">Standard Library</a>, we’re a serverless platform that enables <strong>everyone</strong><em> </em>(yes, <em>everyone</em>! Calling all PMs, designers, marketing teams, sales people, oh and engineers… 🙋)<em> </em>to build, ship, and integrate scalable APIs in a matter of seconds. With the help of our online text editor, <a href="https://code.xyz">Code.xyz</a>, you can do all of this right from your browser.</p><h4>Requirements</h4><ul><li><a href="https://www.stdlib.com">Standard Library</a> account (free)</li><li><a href="https://api.nasa.gov/">NASA</a> API key (free)</li></ul><p><a href="https://www.stdlib.com">Standard Library</a> provides a plethora of API templates that are readily usable. In order to retrieve the APoD API template, go to <a href="https://code.xyz">Code.xyz</a> and search for astronomy-picture-of-the-day by @eileenzhong 💁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A83-gXgFOMpKsFbGw4ek1w.png" /><figcaption>APoD template</figcaption></figure><p>Name your API:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qw5iS2XZcISnxtLzWpdhug.png" /><figcaption>Name your API</figcaption></figure><p>One last step before sending the APoD to your phone!</p><p>You’ll need to properly configure the env.json file. You’ll notice that there are two sets of variables; however, we will be deploying our code to the dev environment, so we will only need to provide the dev variables.</p><p>First, insert your Standard Library library token (STDLIB_LIBRARY_TOKEN):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*IugtoiQ_cm74DI3ByFsNTw.png" /><figcaption>Right click to access this context menu</figcaption></figure><p>Then, insert your <a href="https://api.nasa.gov/">NASA</a> API key. When finished, your env.json file should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*550a1_WyhsMxbtsftBefXg.png" /></figure><p>That’s all the setup you have to do!</p><p>To run the program, click “Debug” to bring the parameter input area into view. Enter your phone number, including the country code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*to7zqRZplUCknfV9sIWvGA.png" /><figcaption>Don’t forget the country code!</figcaption></figure><p>When you click “Run”, you’ll receive NASA’s astronomy picture of the day! 🚀</p><p>That’s not even the coolest part.</p><p>We don’t want to click “Run” every single day to get this text delivered to our phone. Thankfully, <a href="https://www.stdlib.com">Standard Library</a> has a task scheduler where you can customize a schedule to auto<em>magic</em>ally invoke your newly created API.</p><p>In <a href="https://code.xyz">Code.xyz</a>, click the “Tasks” tab. You can then enter a phone number and customize a schedule to your liking:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8BxLtqAKYtvvLlhDSq4vw.png" /><figcaption>Create a scheduled task for your API</figcaption></figure><p><em>Suggestion: schedule the task to execute once a day since APoD is an acronym for astronomy picture of the </em><strong><em>day</em></strong><em>, and hence, the picture won’t change throughout the day.</em></p><p>When you’re happy with the settings, click the blue “Schedule Task” button to schedule your API.</p><p>That’s it! If you know one ☝️, two ✌️, or five 🖐 other people who would appreciate a daily astronomy picture, you can schedule a different task (one for each phone number) for all of them.</p><h4>Bonus section</h4><p>If you’ve made it this far, you deserve a reward 🌈 Now, don’t get too excited (actually — do get excited 🙃). With just 2 more lines of code, you can send your friend a random quote along with the APoD!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hU93lh3CeZ9Frcfrhk9zVA.png" /><figcaption>APoD and a random Paul Jacques Grillo quote</figcaption></figure><p>We’ll be using WordPress’s API to pull a randomized quote: <a href="http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&amp;filter[posts_per_page]=1.">http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&amp;filter[posts_per_page]=1.</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/629d4616d9c3c7d1f45c2a2f22539e47/href">https://medium.com/media/629d4616d9c3c7d1f45c2a2f22539e47/href</a></iframe><p>Don’t worry about all the RegEx (regular expressions) sitting on line 12. The WordPress API just returns some HTML tags that won’t play nicely in an MMS 📱</p><p>Alternatively, you can just replace the value of the quote variable with any chunk of text you’d like to send your friend: const quote = &quot;Hi friend.&quot;</p><p>Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=226f6ca48adc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/text-yourself-the-nasa-picture-of-the-day-with-standard-library-and-node-js-226f6ca48adc">Text Yourself the NASA Picture of the Day with Standard Library and Node.js</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Reddit Moderator Bot With Standard Library + Code.xyz in 10 Minutes]]></title>
            <link>https://medium.com/dailyjs/build-a-reddit-moderator-bot-with-standard-library-code-xyz-in-10-minutes-d85d878d4a0d?source=rss-7c64023ae0a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d85d878d4a0d</guid>
            <category><![CDATA[reddit]]></category>
            <category><![CDATA[reddit-bot]]></category>
            <category><![CDATA[reddit-moderator-bot]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[Eileen]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 07:00:19 GMT</pubDate>
            <atom:updated>2018-11-29T05:30:29.940Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a Reddit Moderator Bot With Standard Library, Code.xyz, and Node.js in 10 Minutes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4877k4Hq9dPdtmvg9hnGFA.jpeg" /></figure><p>If you’re a subreddit moderator, chances are you’ve received requests from community members to delete an inappropriate comment or ban an ill-mannered user. But it’s 2018 going on 2019 — we’re in the midst of the biggest tech era and spoiled with things like AI, automation and bots. We no longer need to perform menial tasks like monitoring subreddits. Together, we’re going to build a Reddit bot that will automatically check a subreddit for flagged comments in <strong>3 easy steps</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBhWFfhy8TuezWrHD-4MkA.png" /><figcaption>Community members can use “<strong>!delete</strong>” (shown above) or “<strong>!ban</strong>” to request bot moderation</figcaption></figure><p>Whether you have no programming knowledge or 15 years of professional experience, you’ll be able to deploy this bot with <a href="https://www.stdlib.com">Standard Library</a>, the API development and hosting platform, in under 10 minutes.</p><p>If you’re not familiar with <a href="https://www.stdlib.com">Standard Library</a>, we’re a serverless platform that enables <strong>everyone</strong><em> </em>(yes, <em>everyone</em>! Calling all PMs, designers, marketing teams, sales people, oh and engineers… 🙋)<em> </em>to build, ship, and integrate scalable APIs in a matter of seconds. With the help of our online editor, <a href="https://code.xyz">Code.xyz</a>, you can do all of this right from your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*-Nq3uEmbxhxPyFtH6pXPDA.png" /></figure><h3>Requirements</h3><ul><li><a href="https://www.reddit.com">Reddit</a> moderator account (for the subreddit you’d like to monitor)</li><li><a href="https://www.stdlib.com">Standard Library</a> account (free)</li></ul><h3>Step 1: Get the Reddit bot template</h3><p><em>Estimated time: 30 seconds</em></p><p>Head over to <a href="https://code.xyz">Code.xyz</a> in your browser and select reddit-moderator-bot by @eileenzhong (that’s me! 🤓👋) in the Community API Sources tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OUjzBURiZZGUcLStVepkBw.png" /></figure><p>Name your API:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iw2634mCBT-7DW4iFeE-Vg.png" /></figure><p>Once done, you’ll conveniently land in <a href="https://code.xyz">Code.xyz</a> (Standard Library’s in-browser text editor) with the Reddit bot project code.</p><h3>Step 2: Copy and paste</h3><p><em>Estimated time: 2-5 minutes</em></p><p>This next step involves expert knowledge of the copy-and-paste skill to set some required environment variables. You’ll notice there are three sets of variables listed in your env.json file: local, dev, and release. We’ll be deploying our code to the dev environment, so we only need to worry about the dev variables for this tutorial!</p><p>All fields are found in env.json:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*32Z3tFxgedvQQoRas-H0Zw.png" /></figure><p>To retrieve your STDLIB_LIBRARY_TOKEN, right click between the quotation marks and select “Insert Library Token…”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*MK_RKXo7iqIN3tPGees-Tw.png" /><figcaption>Right click to access this context menu</figcaption></figure><p>Keys prefaced withREDDIT_-* can be found on <a href="https://www.reddit.com/prefs/apps">Reddit</a> (REDDIT_USERNAME and REDDIT_PASSWORD are your moderator account’s username and password, respectively).</p><p>If you don’t already have a Reddit app, register for one <a href="https://www.reddit.com/prefs/apps">here</a> with your moderator account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0y4nLz79pjv3mEInjCR_Jw.png" /></figure><p>Copy the REDDIT_CLIENT_ID and REDDIT_SECRET_KEY:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*pH3G1u7iLhZvvR3aB-iwiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*ebr-BmsUPepqgou6lOzSiw.png" /></figure><p>Paste both into env.json:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILCpOk7gl7n1ETZZaFgD1w.png" /></figure><p>When your env.json file is properly filled out like the above screenshot, the bot is ready for some preliminary testing.</p><p>Fill out the required parameters (definitions and screenshots below):</p><pre><strong>Parameter definitions</strong></pre><pre><strong>subreddit</strong>: the <strong>name</strong> of the subreddit you are moderating<br><strong>threshold</strong>: what <strong>score</strong> do you want the comment to have in order to perform the requested action? <br><strong>allowBanPermission</strong>: <strong>true</strong> (allow ban requests) / <strong>false</strong> (ignore ban requests)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*38eurNIKO8JeOnvTWe1jLQ.png" /><figcaption>Click Debug to launch the parameter editor</figcaption></figure><p>Then click the “Run” button, which will do 2 things: <em>deploy </em>the API and<em> execute </em>it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmJnpM8mJ4tqf2gHlpgBGQ.png" /><figcaption>Custom parameters</figcaption></figure><p>Congratulations, your bot is live! 😎 🎉 🎊</p><p>When you hit “Run”, your bot scanned through your subreddit for any comments flagged with <strong>!delete</strong> or <strong>!ban</strong> and reacted accordingly by starting a vote!</p><h3><strong>Step 3: Set it and forget it</strong></h3><p><em>Estimated time: 1 minute</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6nnu8xlt7WnXsIXRCv8sA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VU6iqflfYr2W3BsN7E14A.png" /><figcaption>Schedule the <strong>main function</strong> as a task</figcaption></figure><p>Now, the final step is to set a task to automate this process and have your bot check your subreddit every few minutes for flagged comments. You can do this in <a href="https://code.xyz">Code.xyz</a> by scheduling a task, which will automatically execute the API you just created according to a schedule of your choosing.</p><p><em>Suggestion: depending on subreddit traffic, you might increase or decrease the frequency of bot invocation. A good start is to have the bot do a scan once every 5 minutes.</em></p><p>Once you click the “Schedule Task” button in the bottom right corner, your Reddit bot will scan r/{subreddit} to <strong>reply to any new !ban/!delete requests </strong>and <strong>perform these tasks on any comments that meet the score threshold </strong>according to the schedule you have chosen.</p><p><strong>That’s it!</strong> 🌟</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d85d878d4a0d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dailyjs/build-a-reddit-moderator-bot-with-standard-library-code-xyz-in-10-minutes-d85d878d4a0d">Build a Reddit Moderator Bot With Standard Library + Code.xyz in 10 Minutes</a> was originally published in <a href="https://medium.com/dailyjs">DailyJS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intercom: Integration With React Native]]></title>
            <link>https://medium.com/@eileenzhong/intercom-integration-with-react-native-80cfbbf98aff?source=rss-7c64023ae0a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/80cfbbf98aff</guid>
            <category><![CDATA[intercom]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Eileen]]></dc:creator>
            <pubDate>Sun, 16 Apr 2017 07:31:21 GMT</pubDate>
            <atom:updated>2018-10-18T05:32:52.784Z</atom:updated>
            <content:encoded><![CDATA[<p>Intercom is amazing. It’s a simple, easy-to-use chat support service to provide direct communication between your users and you. Web, IOS, and Android installation and configuration guides can be found online and in Intercom’s docs… but tutorials with React Native? Scarce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*58jsoY4FPu6hJy3HPM0bqg.jpeg" /><figcaption>Yeah… it’s easy until there are a bunch of unsupported modules you need to write native code for…</figcaption></figure><p>Thankfully, I’ve successfully integrated Intercom with a React Native project and can hopefully provide you a painless “<em>how to</em>” guide. I’m writing this tutorial a while after installation… so feel free to message me at any time if you feel there is information that I may have forgotten.</p><p>To start this off, (<em>obviously</em>) make an <a href="https://www.intercom.com">Intercom</a> account and create an app. You’ll be issued an API key and an App ID.</p><p>The skeleton of all this is <a href="https://github.com/tinycreative/react-native-intercom">react-native-intercom</a>, a great wrapper library to get us started in the sort-of gnarly web of native+JS code. Just kidding, it’s not that bad.</p><p>First, npm install this package and run react-native link. That’s it for the JS stuff. We’ll come back to this later.</p><h3>iOS</h3><ol><li><a href="https://github.com/intercom/intercom-ios#manual-installation">Download Intercom for iOS</a></li><li>Open up XCode. Drag Intercom.framework to the “Embedded Binaries” section and select “Copy items if needed” to finish.</li><li>In your app’s target’s “Build Phases”, find the “Run Script Phase” section and copy and paste: bash &quot;${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Intercom.framework/strip-frameworks.sh&quot;. This script is needed if you’re planning on submitting this to the App Store.</li><li>Add NSPhotoLibraryUsageDescription to your Info.plist to explain to Apple why it is necessary for this app to have image upload functionality… #ohApple. Personally, I just put “Send photos to help resolve app issues”… duh</li><li>Finally. Let’s get into the code.</li></ol><p>In AppDelegate.m:</p><pre>#import &quot;Intercom/intercom.h&quot;<br>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions<br>{<br>    [Intercom setApiKey:@&quot;YOUR-API-KEY&quot; forAppId:@&quot;YOUR-APP-ID&quot;];<br>    [Intercom registerUnidentifiedUser];<br>}</pre><p>Go to <a href="https://www.intercom.com">Intercom</a> to finish registering your iOS application. Once you’re on the Intercom dashboard, head to your App settings (found in Settings &gt; App Settings) and under the Installation section, click on iOS. Here, you can customize how you want the chat interface to look like (colors, patterns, etc.). Once you click through this, it will tell you to refresh your app after all of the code has been injected properly. When you do a rebuild via XCode or your terminal, you’ll get a congratulatory pop-up from Intercom notifying you that you have successfully finished setting Intercom up.</p><h4>(Optional) Push notifications</h4><p>I’m going to assume you already have push notifications setup with your app.</p><ul><li>Launch “Keychain Access” on your computer and find the iOS push certificate for your application. Once you do, expand it and export the 2 items.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*htQo2DKTWFGpd8rlYE3o4g.png" /></figure><ul><li>Next, create a PEM file from the .p12 you just exported. In your terminal, navigate to the directory the .p12 is saved in and run this command: openssl pkcs12 -in FILENAME.p12 FILENAME.pem -nodes</li><li>Awesome! Now you have the PEM file. Upload it to Intercom like so:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYpKxFjowZbaxP2UCqcLlw.png" /></figure><p>Finally, in AppDelegate.m:</p><pre>- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken<br>{<br>  [Intercom setDeviceToken:deviceToken];<br>}</pre><h3>Android</h3><p>First, add this dependency to app/build.gradle:</p><pre>dependencies {<br>    compile project(&#39;:react-native-intercom&#39;)<br>}</pre><p>Then, install Intercom via 1 of 3 options: Google Cloud Messaging (GCM), Firebase Cloud Messaging (FCM), or without push notifications. If you want push notifications, follow either installation with GCM or FCM. Depending on which one of the 3, you’ll add different dependencies to your app’s build.gradle file:</p><pre>// GCM<br>dependencies {<br>    compile &#39;io.intercom.android:intercom-sdk:3.+&#39;<br>}<br>  <br>// FCM<br>dependencies {<br>    compile &#39;io.intercom.android:intercom-sdk-base:3.+&#39;<br>    compile &#39;io.intercom.android:intercom-sdk-fcm:3.+&#39;<br>}</pre><pre>// No push<br>dependencies {<br>    compile &#39;io.intercom.android:intercom-sdk-base:3.+&#39;<br>}</pre><p>In MainApplication.java:</p><pre>import com.robinpowered.react.Intercom.IntercomPackage;<br>import io.intercom.android.sdk.Intercom;</pre><pre><a href="http://twitter.com/Override">@Override</a><br>protected List&lt;ReactPackage&gt; getPackages() {<br> return Arrays.&lt;ReactPackage&gt;asList(<br>   new IntercomPackage()<br> )<br>};</pre><pre><a href="http://twitter.com/Override">@Override</a><br>  public void onCreate() {<br>    super.onCreate();<br>    Intercom.initialize(this, &quot;YOUR-API-KEY&quot;, &quot;YOUR-APP-ID&quot;);<br>}</pre><p>As with before, navigate back to <a href="https://www.intercom.com">Intercom</a> to finish registering your Android application. When you build via Android Studio and run the app in the emulator, you’ll get a congratulatory pop-up notifying you of a successful setup.</p><h4>(Optional) Push Notifications</h4><p>I set up push notifications with GCM, but if you are going with FCM, it’s a similar protocol :)</p><p>First, go to <a href="https://developers.google.com/mobile/add?platform=android&amp;cntapi=gcm&amp;cnturl=https:%2F%2Fdevelopers.google.com%2Fcloud-messaging%2Fandroid%2Fclient&amp;cntlbl=Continue%20Adding%20GCM%20Support&amp;%3Fconfigured%3Dtrue">Google Developers Page</a> to set up Google services for your application.</p><p>If you do not already have an application listed/registered, you can add one with a specified app name and the package name of your Android app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmJrtc9joRihZw5Q2-oe9w.png" /></figure><p>Once you click the blue “Continue to Choose and configure services&quot;, you’ll be presented with two important pieces of data: your server API key and your sender ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cCNXkQ2TYDjLR574FmxgRw.png" /></figure><p>The server API key will go into the Intercom Android “Enable Push Notifications” section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHdh1snoJd6eU02CX5i9MA.png" /></figure><p>The sender ID will go into your app’s res/values/strings.xml:</p><pre>&lt;string name=&quot;intercom_gcm_sender_id&quot;&gt;YOUR_SENDER_ID&lt;/string&gt;</pre><h3>JAVASCRIPT!!</h3><p>And now… to unravel the magic in JavaScript.</p><p>In whichever component you desire…</p><pre>import React, { Component } from &#39;react&#39;;<br>import Intercom from &#39;react-native-intercom&#39;;</pre><pre>class IntercomExample extends Component {<br>    componentDidMount() {<br>        Intercom.registerForPush();   <br>        Intercom.addEventListener(<br>        Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange);       <br>    }</pre><pre>    componentWillUnmount() {<br>        Intercom.removeEventListener(<br>        Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange);      <br>    }</pre><pre>    componentWillMount() {<br>      Intercom.handlePushMessage();<br>    }</pre><pre>    _onUnreadChange = ({ count }) =&gt; {<br>        console.log(count);    <br>    }</pre><pre>    render() {<br>        // code code codez<br>    }</pre><pre>}</pre><p>And there you have it! Intercom fully integrated into your application.</p><p>Feel free to message and/or leave a comment if you need help setting up Intercom. I’m also open to suggestions on improvements (whether that’s for writing tutorials in the future or regarding this post)! Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80cfbbf98aff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Amplitude Analytics to your React Native App]]></title>
            <link>https://medium.com/@eileenzhong/adding-amplitude-analytics-to-your-react-native-app-5e0715d258f8?source=rss-7c64023ae0a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e0715d258f8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[amplitude]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Eileen]]></dc:creator>
            <pubDate>Fri, 09 Dec 2016 05:12:59 GMT</pubDate>
            <atom:updated>2018-10-18T05:35:59.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3vhIKRr7blmMwqWO.png" /><figcaption>Amplitude Analytics</figcaption></figure><p>Per Facebook’s docs, &quot;sometimes an app needs access to a platform API that React Native doesn&#39;t have a corresponding module for yet.&quot; Unfortunately, React Native doesn’t have a corresponding module for Amplitude. With that being said, this tutorial serves to help you integrate Amplitude easily into your app. :)</p><h3>First things first…</h3><ol><li>Register for an account on the <a href="https://amplitude.com/settings">Amplitude</a> website</li><li>Retrieve your API Key</li></ol><h3>iOS</h3><p>With iOS, we’ll be building via Xcode and bridging JavaScript with native code (obj-C).</p><p>In AppDelegate.m, we’ll be initializing our API key so we don’t have to initialize it in every file that uses Amplitude:</p><pre>#import &quot;Amplitude.h&quot;</pre><pre>... didFinishLaunchingWithOptions: (NSDictionary *) launchOptions {</pre><pre>// your code here</pre><pre>  [[Amplitude instance] initializeApiKey:@&quot;insertyourapikeyhere&quot;];</pre><pre>// your code here</pre><pre>}</pre><p>You will be adding two files to YourApp/ios (RNAmplitude.h and RNAmplitude.m):</p><p>RNAmplitude.h</p><pre>#import &quot;RCTBridgeModule.h&quot;</pre><pre>@interface RNAmplitude : NSObject &lt;RCTBridgeModule&gt;<br>@end</pre><p>RNAmplitude.m</p><pre>#import &quot;RNAmplitude.h&quot;<br>#import &quot;Amplitude.h&quot;<br>#import &quot;AMPIdentify.h&quot;</pre><pre>@implementation RNAmplitude</pre><pre>RCT_EXPORT_MODULE();</pre><pre>- (dispatch_queue_t)methodQueue {<br> return dispatch_get_main_queue();<br>}</pre><pre>RCT_EXPORT_METHOD(initializeApiKey:(NSString *)apiKey) {<br> [[Amplitude instance] initializeApiKey:apiKey];<br>}</pre><pre>RCT_EXPORT_METHOD(setUserId:(NSString *)userId) {<br> [[Amplitude instance] setUserId:userId];<br>}</pre><pre>RCT_EXPORT_METHOD(setUserProperties:(NSDictionary *)properties) {<br> [[Amplitude instance] setUserProperties:properties];<br>}</pre><pre>RCT_EXPORT_METHOD(logEvent:(NSString *)eventwithProperties:(NSDictionary *)properties) {<br> [[Amplitude instance] logEvent:eventwithEventProperties:properties];<br>}</pre><pre>@end</pre><p>And that’s it! You’ve just added Amplitude to your iOS app.</p><h3>Android</h3><p>With Android, we’ll be adding code to existing Java files in the project.</p><p>In build.gradle, add this line of code:</p><pre>compile &#39;com.amplitude:android-sdk:2.13.0&#39;</pre><p>In your manifest file, add:</p><pre>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;</pre><p>You will need to add 2 files, RNAmplitude.java and RNAmplitudePackage.java, to your project:</p><p>RNAmplitude.java</p><pre>package com.YourApp;</pre><pre>import com.amplitude.api.Amplitude;<br>import android.app.Activity;<br>import android.app.Application;</pre><pre>import com.facebook.react.bridge.NativeModule;<br>import com.facebook.react.bridge.ReactApplicationContext;<br>import com.facebook.react.bridge.ReactContext;<br>import com.facebook.react.bridge.ReactContextBaseJavaModule;<br>import com.facebook.react.bridge.ReactMethod;</pre><pre>import com.facebook.react.bridge.ReadableMap;<br>import com.facebook.react.bridge.ReadableMapKeySetIterator;<br>import com.facebook.react.bridge.ReadableType;</pre><pre>import org.json.JSONException;<br>import org.json.JSONObject;</pre><pre>import java.util.Map;</pre><pre>import java.io.*;</pre><pre>public class RNAmplitude extends ReactContextBaseJavaModule {<br> private Activity mActivity = null;<br> private Application mApplication = null;</pre><pre> public RNAmplitude(ReactApplicationContext reactContext,  <br> Application mApplication) {<br>   super(reactContext);<br>   this.mActivity = getCurrentActivity();<br>   this.mApplication = mApplication;<br> }</pre><pre> @Override<br> public String getName() {<br>   return &quot;RNAmplitude&quot;;<br> }<br> <br> @ReactMethod<br> public void initialize(String apiKey) {<br>  Amplitude.getInstance().initialize(getCurrentActivity(), <br>  apiKey).enableForegroundTracking(this.mApplication); <br> }</pre><pre> @ReactMethod<br> public void logEvent(String identifier, ReadableMap properties) {<br>   try {<br>      JSONObject jProperties = <br>      convertReadableToJsonObject(properties);<br>      Amplitude.getInstance().logEvent(identifier, jProperties);<br>   } catch (JSONException e) {<br>      return;<br>   }<br> }</pre><pre> @ReactMethod<br> public void setUserId(String id) {<br>   Amplitude.getInstance().setUserId(id);<br> }</pre><pre> public static JSONObject convertReadableToJsonObject(ReadableMap <br> map) throws JSONException {<br>   JSONObject jsonObj = new JSONObject();<br>   ReadableMapKeySetIterator it = map.keySetIterator();</pre><pre>   while (it.hasNextKey()) {<br>      String key = it.nextKey();<br>      ReadableType type = map.getType(key);</pre><pre>      switch (type) {<br>         case Map:<br>            jsonObj.put(key, <br>            convertReadableToJsonObject(map.getMap(key)));<br>            break;         <br>         case String:<br>            jsonObj.put(key, map.getString(key));<br>            break;<br>         case Number:<br>            jsonObj.put(key, map.getString(key));<br>            break;<br>         case Boolean:<br>            jsonObj.put(key, map.getString(key));<br>            break;<br>         case Null:<br>            jsonObj.put(key, map.getString(key));<br>            break;<br>       }<br>   }<br>   return jsonObj;<br> }</pre><pre>}</pre><p>RNAmplitudePackage.java</p><pre>package com.YourApp;</pre><pre>import android.app.Activity;<br>import android.app.Application;</pre><pre>import com.facebook.react.ReactPackage;<br>import com.facebook.react.bridge.JavaScriptModule;<br>import com.facebook.react.bridge.NativeModule;<br>import com.facebook.react.bridge.ReactApplicationContext;<br>import com.facebook.react.uimanager.ViewManager;</pre><pre>import java.util.*;<br>import java.io.*;</pre><pre>public class RNAmplitudePackage implements ReactPackage {</pre><pre>   private Application mApplication = null;</pre><pre>   public RNAmplitudePackage(Application application) {<br>      mApplication = application;<br>   }</pre><pre><br>   @Override    <br>   public List&lt;NativeModule&gt; createNativeModules(ReactApplicationContext reactContext) {<br>      List&lt;NativeModule&gt; modules = new ArrayList&lt;&gt;();<br>      modules.add(new RNAmplitude(reactContext, this.mApplication));<br>      return modules;<br>   }</pre><pre>   @Override    <br>   public List&lt;Class&lt;? extends JavaScriptModule&gt;&gt; createJSModules() <br>   {<br>        return Collections.emptyList();<br>   }</pre><pre>   @Override    <br>   public List&lt;ViewManager&gt; createViewManagers(ReactApplicationContext reactContext) <br>   {<br>        return Collections.emptyList();<br>    }</pre><pre>}</pre><p>In MainApplication.java:</p><pre>@Override<br>protected List&lt;ReactPackage&gt; getPackages() {<br> return Arrays.&lt;ReactPackage&gt;asList(<br>   new MainReactPackage(),<br>   new RNAmplitudePackage(this),<br> )<br>};</pre><p>Since I initialized my api key in native code in my iOS counterpart, I’m going to be consistent and initialize my key in native code for Android. Thus, in MainActivity.java, I’m going to add the following line to onCreate():</p><pre>Amplitude.getInstance().initialize(this, &quot;insertyourapikeyhere&quot;);</pre><h3>Finally, the moment we’ve all been waiting for…</h3><p>In your .js/.jsx files:</p><pre>import { NativeModules } from &#39;react-native&#39;;<br>import { RNAmplitude as Amplitude } from &#39;NativeModules&#39;;</pre><pre>// To use Amplitude:<br>// Amplitude.logEvent(&quot;Some event&quot;, { &quot;JSON Key&quot; : &quot;JSON Value&quot; });</pre><p>Noteworthy: you want to keep the package name and associated methods the same across obj-C and java code. That way, when you import the module into your JavaScript files, you won’t need any code or logic to differentiate between Android and iOS!</p><p>Have fun, and code on.</p><p><em>Feel free to ping me at ejzhong@berkeley.edu if you need help getting Amplitude amp’d up #NoPunIntended</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e0715d258f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS made simple]]></title>
            <link>https://medium.com/@eileenzhong/css-made-simple-e2af928cfe06?source=rss-7c64023ae0a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2af928cfe06</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Eileen]]></dc:creator>
            <pubDate>Tue, 26 Jul 2016 02:08:49 GMT</pubDate>
            <atom:updated>2016-11-21T02:42:27.547Z</atom:updated>
            <content:encoded><![CDATA[<p>While styling is fun, it can also be tedious. It’s a hassle to go back and forth between your text editor and local host. You increased the padding from 20px to 50px, but now you have to swipe back to Chrome and refresh the browser to see the updated result. That’s quality code time spiraling down the drain.</p><p>What if I told you that you can update your CSS and see the changes simultaneously? Yes, it is possible.</p><p>Simply open up your dev tools, load your working directory into the sources panel workspace, and watch the magic happen. Here are the step-by-step instructions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*GUbNbASP3IMmi61nMsNvxg.png" /><figcaption>Load working directory into workspace.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*pv5D1WBiucTd_AELzreOYA.png" /><figcaption>Map it to your local disk storage.</figcaption></figure><p>Yup, that’s all. Now you can do <strong>all CSS-related code</strong> in the styles pane right in the browser and your .css file will automatically update as well.</p><p>Style on!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2af928cfe06" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>