<?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 Sean Conrad on Medium]]></title>
        <description><![CDATA[Stories by Sean Conrad on Medium]]></description>
        <link>https://medium.com/@seanconrad_25426?source=rss-5f0c3e67dc21------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2vsoOVFD3N4AarR-NEA-QQ.jpeg</url>
            <title>Stories by Sean Conrad on Medium</title>
            <link>https://medium.com/@seanconrad_25426?source=rss-5f0c3e67dc21------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:30:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seanconrad_25426/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[React-Native and testing app using diawi.com]]></title>
            <link>https://medium.com/@seanconrad_25426/react-native-and-testing-app-using-diawi-com-f4b079786127?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b079786127</guid>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 25 Feb 2019 04:26:18 GMT</pubDate>
            <atom:updated>2019-02-25T19:43:26.121Z</atom:updated>
            <content:encoded><![CDATA[<p>So I’m nearing the end of my development of my React-Native application and I wanted to start sending it to people I know for some beta-testing. Two routes I found were using Apple’s TestFlight or using <a href="https://www.diawi.com/">diawi.com</a>. I was starting to go through TestFlight, but you need testers Apple ID’s in order for this to work. The friend who I was going to have test, forgot their email’s password so they couldn’t sign in to their email to accept being added to my TestFlight, so I decided to use diawi.com. The following steps require you to have an Apple Developer account.</p><p>First thing I had to do was get my friend’s iPhone’s UDID that I wanted my app to be tested on. You can get the UDID from <a href="https://webapp.diawi.com/device">https://webapp.diawi.com/device</a>. Open that link on the phone that you want to get the UDID on and install the profile and it will open up safari containing the UDID.</p><p>Next thing is to add the UDID to your Apple Developer account’s device list.</p><p><a href="https://developer.apple.com/account/ios/device/">Sign In - Apple</a></p><p>After you add the device, we need to head to the project in Xcode to export the the app to get a .ipa file.</p><p>In Xcode, Change the Product destination to ‘Generic IOS Device’. At the top, click Product &gt; Destination &gt; ‘Generic IOS Device’. Then do Product &gt; Build.</p><p>From there you need to Archive the application in order to export it.</p><p>Product &gt; Archive. This takes a few minutes to complete. From there a new screen will pop up and select ‘Validate’. After the app validates you’re able to export the application by clicking ‘Distribute App’.</p><p>Since we’re using diawi you’ll select to export as an ‘Ad Hoc’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KrTyNSVExEWCqfFZg9dHrQ.png" /></figure><p>And on the next page you’ll want to select from the dropdown, ‘All compatible device variants’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Abzqmillm5PYdx-I7Rkbyw.png" /></figure><p>Click next, stick to the default, ‘Automatically manage signing’. This will take a minute or so and then click ‘Export’ on the next screen. Export it to some place easily accessible because we’ll need to go to the file location in the next part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYUq3VX84nNCRRbxq76KFA.png" /></figure><p>Now, head over to <a href="https://www.diawi.com/">diawi.com</a> and select ‘Add files’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJtelxdxSzsYfoyUtBW_eg.png" /></figure><p>We’re going to go in to the folder that we just exported and select the .ipa file located at ExportedProjectName/Apps/ProjectName.ipa Once selected you’ll hit send!</p><p>That will return a a link that you can send to the friend’s phone who’s UDID you added and they will then be able to open that link on SAFARI and install your application for testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b079786127" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Native, Rails 5 and Carrierwave multiple photo uploads]]></title>
            <link>https://medium.com/@seanconrad_25426/react-native-rails-5-and-carrierwave-multiple-photo-uploads-c47aac4c0874?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/c47aac4c0874</guid>
            <category><![CDATA[rails-5]]></category>
            <category><![CDATA[react-native-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[carrierwave]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 18 Feb 2019 01:13:01 GMT</pubDate>
            <atom:updated>2019-02-18T01:17:16.963Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m currently in the middle of a React-Native project and found I myself needing multiple photos to be uploaded. I couldn’t find a great resource that told me exactly how to do this. So after spending a day bashing my head against the wall, I give you this:</p><h3>Backend</h3><p>Install Carrierwave</p><pre>gem install carrierwave</pre><p>Create an uploader with the command below:</p><pre>rails generate uploader Avatar</pre><p>This should give you a file in app/uploaders/avatar_uploader.rb</p><p>In your Model, let’s say Post.rb, you’ll want to attach your uploader to it like this:</p><pre>class Post &lt; ApplicationRecord<br>   mount_uploaders :avatars, AvatarUploader<br>end</pre><p>Notice above, we have mount_uploaders and :avatars as being plural. This is needed for multiple photos.</p><p>In your controller’s params, you’ll want to permit avatars like this:</p><pre>def post_params<br>   params.require(:post).permit(:title, :description, {avatars: []})<br>end</pre><p>And if you’ve already migrated, you’ll want to add a new column to your model:</p><pre>rails g migration add_avatar_to_posts avatar:json<br>rails db:migrate</pre><p>And that should do it to allow for an array of image URI’s to be added to a post.</p><h3>FrontEnd</h3><p>For the front end, we will be taking a photo and sending it to the back end to be stored.</p><p>I’m using <a href="https://github.com/react-native-community/react-native-image-picker">ImagePicker</a> in order to access the phone’s camera and camera roll. I’m going to skip on how to use ImagePicker but if you are going to use it, make sure to read the <a href="https://github.com/react-native-community/react-native-image-picker/blob/master/docs/Install.md">install docs</a>.</p><p>Now on to the fetch request. I’m using <a href="https://github.com/joltup/rn-fetch-blob">rn-fetch-blob</a> in order to make the fetch request.</p><pre>npm i --save rn-fetch-blob<br>react-native link</pre><p>Also make sure to import it at the top:</p><p>import RNFetchBlob from rn-fetch-blob</p><p>Here is the code for the RNFetchBlob post request with the contained image.</p><pre>onSubmit = () =&gt;{</pre><pre>RNFetchBlob.fetch(&#39;POST&#39;, `<a href="http://${environment[&#39;BASE_URL&#39;]}/api/v1/skate_spots`">http://yourbackenedURL/api/v1/posts`</a>, {<br>          Authorization : `${environment[&#39;API_KEY&#39;]}`,<br>          &#39;Content-Type&#39; : undefined,<br>        },[<br>            {name : &#39;avatars[]&#39;,<br>             filename : `${image.name}`,<br>             type:&#39;image/jpg&#39;,<br>             data: `RNFetchBlob-file://${image.uri}`<br>            },<br>            { name : &#39;title&#39;, data : &#39;my title&#39;},<br>            { name : &#39;description&#39;, data: &#39;my description&#39;},<br>          ]<br>         ).then((resp) =&gt; {<br>          console.log(&#39;RESPONSE FROM SERVER&#39;, resp)<br>        .catch((err) =&gt; {<br>          console.log(&#39;Error creating new post: &#39;, err)<br>        })<br>      }</pre><p>After messing with regular fetch and axios calls, I found that for some reason Carrierwave was saying I wasn’t using multipart/form data, even though I did specify content-type and was using formData(). Specifically this error:</p><pre>carrierWave::FormNotMultipart (You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.)</pre><p>RNFetchBlob cleared this up for me.</p><p>The above code is good for one photo, so if you want more than one, you’ll need to create the array of objects dynamically. Here is code that does this for you:</p><pre>onSubmit = () =&gt;{<br>      let postData = [<br>            { name : &#39;title&#39;, data : &#39;my title&#39;},<br>            { name : &#39;description&#39;, data: &#39;my description&#39;},<br>          ]<br>      for (image of arrayOfPhotos){<br>       data.push({<br>          name : &#39;avatars[]&#39;,<br>          filename : `${image.name}`,<br>          type:&#39;image/jpg&#39;,<br>          data: `RNFetchBlob-file://${image.uri}`<br>        })<br>      }</pre><pre>RNFetchBlob.fetch(&#39;POST&#39;, `<a href="http://${environment[&#39;BASE_URL&#39;]}/api/v1/skate_spots`">http://yourbackenedURL/api/v1/posts`</a>, {<br>          Authorization : `${environment[&#39;API_KEY&#39;]}`,<br>          &#39;Content-Type&#39; : undefined,<br>        },<br>          postData<br>        ).then((resp) =&gt; {<br>          console.log(&#39;RESPONSE FROM SERVER&#39;, resp)<br>        .catch((err) =&gt; {<br>          console.log(&#39;Error creating new post: &#39;, err)<br>        })<br>      }</pre><p>After the onSubmit function is called, the image will be stored on the backend at and ready for retrieval on the frontend.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c47aac4c0874" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Native Async Request in a Redux Action]]></title>
            <link>https://medium.com/@seanconrad_25426/react-native-async-request-in-a-redux-action-935d71101119?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/935d71101119</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[asyncstorage]]></category>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 03:49:39 GMT</pubDate>
            <atom:updated>2019-01-28T03:49:39.625Z</atom:updated>
            <content:encoded><![CDATA[<p>In my current React-Native application I just recently implemented Redux and JWT Auth. Implementing the login was fine but when it came time to make requests with the JWT token, things got a little weird. If you don’t know already, React-Native makes use of <a href="https://facebook.github.io/react-native/docs/asyncstorage">AsyncStorage</a> which is a React-Native class that can save small pieces of data on your mobile device as opposed to saving data in the browser’s LocalStorage like in ReactJS.</p><p>Both of these methods of storing and retrieving small pieces of data act quite similar however, as the name implies, AsyncStorage retrieves data with async requests. This doesn’t play very nice with Redux which requires it’s functions to be plain objects. Actually that’s the exact error message I received.</p><h4>Actions must be plain objects. Use custom middleware for async actions</h4><p>The <a href="https://github.com/reduxjs/redux-thunk/issues/146#issuecomment-316976419">solution</a> I found was found on Github by user dwayne. The solution requires you to have Thunk installed and implemented.</p><p>So, do :</p><p>npm i redux-thunk redux-devtools-extension --save</p><p>And make sure you store.js looks like this:</p><pre>import { createStore, applyMiddleware } from ‘redux’<br>import rootReducer from ‘./reducers/index.js’<br>import thunk from ‘redux-thunk’<br>import { composeWithDevTools } from ‘redux-devtools-extension’;</pre><pre>const store = createStore(<br> rootReducer,<br> composeWithDevTools(applyMiddleware(thunk)<br>))</pre><pre>export default store</pre><p>After Thunk has been implemented we’ll take a look at the actions. What we’ll do is created two actions. The first one makes use of Thunk to act as a normal function and retrieves the value from our async request. It then makes a call to our second action that is a plain object.</p><pre>export function fetchAsyncValue() {<br>  return function action(dispatch) {<br>    dispatch({ type: &quot;ANY_DISPATCH_TYPE&quot; })<br>       AsyncStorage.getItem(&quot;jwt&quot;)<br>      .then(jwtKey =&gt; dispatch(receivingAsyncVal(jwtKey)))<br>      .catch((error) =&gt; {<br>        console.log(&#39;Error: &#39;, error)<br>      })<br>  }<br>}</pre><pre>export function receivingAsyncVal(val){<br>      return (dispatch) =&gt;{<br>        return fetch(`<a href="http://${environment[&#39;BASE_URL&#39;]}/api/v1/skate_spots`,{">http:/yourapisite.com/api/v1/users`,{</a><br>          method: &#39;GET&#39;,<br>          headers: {<br>            Authorization: `Bearer ${val}`<br>          }<br>        })<br>        .then(r=&gt;r.json())<br>        .then(data=&gt;dispatch({type:&#39;GET_API_DATA&#39;, payload:data}))<br>    }<br>}</pre><p>Here, AsyncStorage.getItem(“jwt”) is our async call which, once it’s finished it calls the second action and passes in the async returned value. And that is how you can do async calls within Redux.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=935d71101119" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Native and Apple Maps]]></title>
            <link>https://medium.com/@seanconrad_25426/react-native-and-apple-maps-fb49af6f2287?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb49af6f2287</guid>
            <category><![CDATA[apple-maps]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 21 Jan 2019 00:42:30 GMT</pubDate>
            <atom:updated>2019-01-21T00:42:30.371Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m currently in the middle of creating a React-Native application that uses a map and I wanted to get up and running quickly, so I chose to go with Apple Maps which requires no extra configuration and no API key. Going forward I will show you how to implement a map into your React-Native application.</p><p>If you don’t already have a project open and ready to go, I’d suggest going through <a href="https://facebook.github.io/react-native/docs/getting-started.html">this</a> quick tutorial to getting your project started. After getting the boilerplate ready, we’ll install react-native-maps and link it.</p><pre>npm i react-native-maps --save<br>react-native link</pre><p>Let’s create a new component named Map.js</p><p>Inside Map.js we’ll import the react-native-maps library at the top. The StyleSheet and Dimensions imported from react-native is in the next part.</p><pre>import React, { Component } from &#39;react&#39;<br>import MapView from &#39;react-native-maps<br>import { StyleSheet, Dimensions, View } from &#39;react-native</pre><p>What we want to do next is create a stylesheet for the map. We’re going to grab the dimensions of the device that we’re on and pass them to the stylesheet. This is going to allow the map to fill the dimensions of the screen.</p><pre>let {height, width} = Dimensions.get(&#39;window&#39;)</pre><pre>const styles = StyleSheet.create({<br> container: {<br>   height: height,<br>   width: width,<br> },<br> map: {<br>   ...StyleSheet.absoluteFillObject,<br> },</pre><p>The next part is creating the map. We’ll create a View and place MapView inside of it containing props for our style and an initialRegion which is your starting location on the map.</p><pre>export default Map extends Component{</pre><pre>render(){<br>  return(<br>    &lt;View style={styles.container}&gt;<br>      &lt;MapView<br>         style={styles.map}<br>         initialRegion={{<br>           latitude: 37.78825,<br>           longitude: -122.4324,<br>           latitudeDelta: 0.0922,<br>           longitudeDelta: 0.0421,<br>         }}<br>         /&gt;<br>    &lt;/View&gt;<br>    )<br>  }<br>}</pre><p>From here, let’s import our component into our App.js</p><pre>import React, { Component } from &#39;react&#39;;<br>import Map from &#39;./components/Map&#39;</pre><pre>export default class App extends Component {<br>  render(){<br>    return &lt;Map/&gt;<br>  }<br>}</pre><p>Next you’ll run react-native run-ios and this will open up the simulator to view our newly added map!</p><p>For documentation and further help, please view the docs for <a href="https://facebook.github.io/react-native/">react-native</a> and <a href="https://github.com/react-native-community/react-native-maps">react-native-maps</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb49af6f2287" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[helloWorld with Salesforce Lightning Components]]></title>
            <link>https://medium.com/@seanconrad_25426/helloworld-with-salesforce-lightning-components-cf536e6b1817?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf536e6b1817</guid>
            <category><![CDATA[hello-world]]></category>
            <category><![CDATA[lightning-components]]></category>
            <category><![CDATA[salesforce]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 14 Jan 2019 03:07:30 GMT</pubDate>
            <atom:updated>2019-01-14T03:07:30.030Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m currently interview with companies and one them uses the Salesforce Lightning Components with the app that they are building. At first I was reluctant to learning the framework but it turned out to not be as bad as I thought. Here’s the steps in to getting a helloWorld component written.</p><p>First you’ll want <a href="https://trailhead.salesforce.com/en">create a Salesforce account</a> and once inside I’d recommend reading <a href="https://trailhead.salesforce.com/content/learn/modules/lex_dev_lc_basics/lex_dev_lc_basics_prereqs">this</a> article first. It basically runs over the pre-reqs for getting starting with lightning components and the lightning component learning module. I highly recommend going through that module. But here, we’re justing to get straight into writing hello world. At the very bottom of <a href="https://trailhead.salesforce.com/content/learn/modules/lex_dev_lc_basics/lex_dev_lc_basics_prereqs">the</a> article page, select a playground, or create a new one and hit ‘launch’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*JTTQi-mRrQvei_1o9Wkccg.png" /></figure><p>After hitting launch, salesforce will take you to a playground. The playground is an area where you can test and create lightning components. On the top right of the playground hit the gear icon and select ‘Developer Console’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*TALZUggzP2XDqVtElxhKUA.png" /></figure><p>The Dev Console is the area to create your lightning component. At the top right, we’ll hit File &gt; New &gt;Lightning Component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*LFa2f1QCPepfOnt1e-4BIg.png" /></figure><p>Give it a name of helloWorld and hit submit. Keep the helloWorld.cmp tab open and close out the other one.</p><p>Lightning components themselves use XML, so we can use plain HTML inside of the component to write out helloWorld:</p><pre>&lt;aura:component &gt;<br>    <br>    &lt;p&gt;Hello World&lt;/p&gt;<br> <br>&lt;/aura:component&gt;</pre><p>After that’s written, hit control or command + s to save.</p><p>Here’s our helloWorld. Plain and simple. Now how do we view this? In order for our component to be viewed, it needs to be imported in to an application. There are a few different types of applications that a component can live in but for this tutorial, we’re only going to use ‘Lightning Application’. So let’s do File &gt; New &gt; Lightning Application and name it helloWorldApp.</p><p>In this new file, helloWorldApp, we’re going to import our helloWorld.cmp component like this:</p><pre>&lt;aura:application &gt;</pre><pre>    &lt;c:helloWorld/&gt;</pre><pre>&lt;/aura:application&gt;</pre><p>After that’s written, save it and on the right side of the console inside of the helloWorldApp.app, click ‘Preview’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WjSxvAgFN6_vx7-ofmXFg.png" /></figure><p>This will open a preview of our component!</p><p>If you are looking to get started with Lightning Components again, I’d highly recommend going through their <a href="https://trailhead.salesforce.com/content/learn/modules/lex_dev_lc_basics">Lightning Components learning module</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf536e6b1817" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a Ruby On Rails/DigitalOcean one-click app]]></title>
            <link>https://medium.com/@seanconrad_25426/setting-up-a-ruby-on-rails-digitalocean-one-click-app-83bfff30b6a6?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/83bfff30b6a6</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[digitalocean]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Mon, 31 Dec 2018 04:17:19 GMT</pubDate>
            <atom:updated>2018-12-31T04:17:19.410Z</atom:updated>
            <content:encoded><![CDATA[<p>So you have a backend created with Ruby on Rails and you’d like to deploy it on DigitalOcean. Here’s a simple guide on doing that.</p><p>First navigate to DigitalOcean’s page and create a new One-click app contains the Ruby-on-Rails setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qU9hW6og19SQIn6pvQsi2w.png" /></figure><p>Once that is created, you should receive your first time username and password and log in to the droplet and secure it following <a href="http://www.codelitt.com/blog/my-first-10-minutes-on-a-server-primer-for-securing-ubuntu/">this</a> guide.</p><p>The next step is log in to your ‘rails’ account that is already created for you. The password is in the bulletin that is posted right when you log in to your droplet.</p><p>To log in to the rails account do sudo -i -u rails . The password it will ask you for here is your ‘root’ password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jdr-NrscV0sWkpvEsBAkig.png" /><figcaption>Rails credentials on the bulletin in the DO droplet.</figcaption></figure><p>After getting logged in, what you’re going to want to do is create a new ssh key pair and add it to Github in order for your DigitalOcean droplet to pull down your backend. Follow <a href="https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/">this</a> guide to do that. After you have the new key created and imported in to your Github account, pull down the backend in to the rails home folder, /home/rails/</p><p>From there, you’re going to want to edit Nginx sites-available file.</p><pre>cd /etc/nginx/sites-available/<br>vim rails</pre><p>And the only thing that needs to be changed here is the 3rd line that contains ‘root’. Change it to point to the public folder in your rails project. Should be something like /home/rails/myApp/public .</p><pre>server {<br>    listen   80;<br>    root /home/rails/myApp/public;<br>    server_name _;<br>    index index.htm index.html;</pre><pre>location ~ /.well-known {<br>                allow all;<br>        }</pre><pre>location / {<br>        proxy_pass <a href="http://localhost:3000/">http://localhost:3000</a>;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><p>Next run nginx -t to make sure the config file has no errors then run nginx restart to restart the Nginx service.</p><p>After this step, you rails server should now be available at your droplets IP address.</p><p>Ruby-on-Rails DigitalOcean one-click documentation</p><p><a href="https://www.digitalocean.com/docs/one-clicks/ruby-on-rails/">https://www.digitalocean.com/docs/one-clicks/ruby-on-rails/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83bfff30b6a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting a GoDaddy domain to a DigitalOcean droplet]]></title>
            <link>https://medium.com/@seanconrad_25426/connecting-a-godaddy-domain-to-a-digitalocean-droplet-cb1ed5662d58?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb1ed5662d58</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[domains]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[digitalocean]]></category>
            <category><![CDATA[godaddy]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Sun, 23 Dec 2018 22:47:45 GMT</pubDate>
            <atom:updated>2018-12-23T22:47:45.003Z</atom:updated>
            <content:encoded><![CDATA[<p>This article assumes you already bought your domain and have already set up a DigitalOcean droplet and are ready to connect the two.</p><p>First you’ll log in to your DigitalOcean account and on the top right, click Create &gt; Domains/DNS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*wKEJK0R3wWiB5UuwKTV3WA.png" /><figcaption>Click Create &gt; Domains/DNS</figcaption></figure><p>From there, on the Domains tab you’ll enter your acquired GoDaddy domain name. In the box to the right of that, you can select any of your projects. It’ll be greyed out if you only have one project. After that, click ‘add domain’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dwu2adqITpqpwsl52Nhh4A.png" /><figcaption>Adding a new domain</figcaption></figure><p>After clicking ‘add domain’ it will take you to a new screen where you’ll create a new record. We’re going to create two A records with our domain name. The hostname for the first is going to be mynewdomain.com and the second is going to be www.mynewdomain.com . Both will be redirecting to the same Droplet. So in the ‘Will redirect to’ box, you can either type in your Droplet’s IP address or you can click the box and a dropdown of your droplets will show and you can select the correct one. We create one with and without www so that your site will be able to be accessed when someone types in mynewdomain.com or www.mynewdomain.cominto their browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wCAOjvG0cH91aLtY88kDuw.png" /><figcaption>Creating a new A record</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rnIoaHdfgE1M2Hk6j1Lhtw.png" /><figcaption>What should be shown after both records are created</figcaption></figure><p>Now the domain is added to the droplet. We can now point it to DigitalOcean from GoDaddy.</p><p>First you’ll wan to head to your Domain Manager and click on the three dots next to your domain name and click ‘Manage DNS’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*VUMCBQcQOKzpe6BQ4RA5Lg.png" /></figure><p>This will take you to the DNS management page. You’ll want to add these three name servers:</p><pre>ns1.digitalocean.com</pre><pre>ns2.digitalocean.com</pre><pre>ns3.digitalocean.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*DkHiW6-7CSUNnwRkIGiG-A.png" /></figure><p>After this step you should be good to go! It can take up to a day for the changes to propagate but afterwords you can check <a href="https://check-host.net/?lang=en">check-host.net</a> and input your hostnames, with and without www , to see if you if everything has worked out properly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb1ed5662d58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a Create-React-App with PM2 and Nginx on DigitalOcean]]></title>
            <link>https://medium.com/@seanconrad_25426/setting-up-a-create-react-app-with-pm2-and-nginx-on-digitalocean-1fd9c060ac1f?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fd9c060ac1f</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[pm2]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Sun, 16 Dec 2018 23:09:24 GMT</pubDate>
            <atom:updated>2018-12-20T02:58:02.174Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently finished one of my projects and wanted to host it online for the world to see all its beauty. I didn’t want to use Heroku as I thought that it abstracts too much of the server configurations and I myself wanted to know how the server configs worked.</p><p>I first started looking around on how to host a React app on DigitalOcean. Side note, if you haven’t set up a Linux VPS on DigitalOcean before, I’d highly recommend. It’s one of the simplest things to do and for the cheapest option it’s about 5$ a month. Not being paid to say that, I just enjoy their service and I’ll be using it on for the rest of the tutorial. Ok back to the server. I used DigitalOcean’s <a href="https://www.digitalocean.com/docs/one-clicks/nodejs/">NodeJS One-Click app</a> as my starting template.</p><p>After the server was created, I like to secure the server the first time I log in, <a href="https://www.codelitt.com/blog/my-first-10-minutes-on-a-server-primer-for-securing-ubuntu/">here’s</a> a link to an article I follow. Next do the installations.</p><pre>sudo apt-get install nginx</pre><pre>sudo npm i -g create-react-app react-scripts@latest pm2@latest</pre><p>Go to a directory where you’d like to your React app and run:</p><pre>create-react-app my-app</pre><p>Once you have a ready to deploy application, go to your react app’s directory and run</p><pre>sudo npm run build</pre><p>The above code creates a minified version of your code optimized for production in the my-app/build directory.</p><p>We use PM2 as an application manager in order to keep our app running after we log out of the server.</p><pre>pm2 start my-app/node_modules/react-scripts/scripts/start.js --name &quot;my-app&quot;</pre><p>This will have our application running in the background.</p><p>Here’s a few commands to note when using pm2:</p><pre>pm2 status<br>pm2 restart my-app<br>pm2 stop my-app<br>pm2 start my-app<br>pm2 delete my-app</pre><p>Now it’s time we get Nginx configured in order to expose our application.</p><p>First, create a new site in /etc/nginx/sites-available/</p><pre>cd /etc/nginx/sites-available/<br>vim my-app.com</pre><p>Then inside /etc/nginx/sites-available/my-app.com place the server configurations:</p><pre>server {</pre><pre>listen 80;<br>  server_name my-app.com;<br>  server_name your.server.ip.goes.here;<br>  root /root/my-app.com;<br>  index index.html;<br>  <br>  access_log /var/log/nginx/my-app.com.access.log;<br>  error_log /var/log/nginx/my-app.com.error.log;</pre><pre>location / {<br>    try_files $uri /index.html =404;<br>  }</pre><pre>}</pre><p>Nginx needs to be told that a given site is active. To do this, create a symlink in sites-enabled</p><pre>cd /etc/nginx/sites-enabled<br>ln -s ../sites-available/my-app.com</pre><p>Run nginx -t to see if there are any errors with the config file, if any come up, try and find the error and correct it.</p><p>Restart Nginx:</p><pre>/etc/init.d/nginx restart</pre><p>Navigate to your servers IP on your local computer and your site should now be hosted!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fd9c060ac1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One, two, Three.js]]></title>
            <link>https://medium.com/@seanconrad_25426/one-two-three-js-478674956d38?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/478674956d38</guid>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Thu, 30 Aug 2018 00:46:09 GMT</pubDate>
            <atom:updated>2018-08-30T16:06:44.400Z</atom:updated>
            <content:encoded><![CDATA[<p>So, one of the many things that have intrigued me about programming is the fact that you can create a 3D object, scene or even a full 3D game. As with almost any inception that I have of something that I want to build, there’s usually a tool that has been made to do the job.</p><h3>WebGL</h3><p>WebGL is a Javascript API used to create 2D and 3D renderings built into the browser without having to import any other libraries however, the dependency comes from the power of your GPU. However WebGL is very tedious just to do one thing. So thanks to the JS community there has been a number of WebGL frameworks that have been created. Three.js, <a href="https://aframe.io/">A-Frame</a>, for VR experiences, <a href="https://github.com/jeromeetienne/AR.js/blob/master/README.md">AR.js</a> for AR experiences(which is actually is built upon A-frame and Three.js), PlayCanvas, Goo Engine…</p><h3>Three.js</h3><p>Three.js, created by <a href="https://github.com/mrdoob">Mrdoob</a> and <a href="https://github.com/mrdoob/three.js/graphs/contributors">contributors</a>, is one the most successful open source projects of recent years, and by far the most popular WebGL framework in use today. It’s seen by many as a victory of the open web, and of open standards that came about after years of relying on closed platforms like Adobe Flash. I wanted to see how difficult it was in order to get just a rotating cube on the screen and I stumbled upon <a href="https://www.jonathan-petitcolas.com/2013/04/02/create-rotating-cube-in-webgl-with-threejs.html">this</a> tutorial and it ended up being a lot easier than I thought.</p><p>So in order to display something, you need three elements: a scene, a camera and a renderer. From there, you add the object .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*D3oH9fhoEK88PUDvyQUIFw.png" /></figure><p>The first thing here is that we create our global variables that we’ll be using later in the code. The init() function is basically our runner but it also will be creating the scene for us and appending it to the DOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkrKplvX41tS0W0XHCz0ww.png" /></figure><p>This is where we create the camera. The argument we are giving the camera are the FOV in degrees, the aspect ratio, near and far clippings. The nearer argument means that anything that is nearer than that number, won’t be rendered. Far means anything that is farther than far, won’t be rendered. We set the position in the scene and face the camera toward the scene’s center position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p3c1a-3RF6YbE5lY7SiBSg.png" /></figure><p>THREE.WeGLRenderer is calling WebGL to render the scene for us and renderer.setSize is saying to render to the full size of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1t9HWNyHKEHACXS5Aj9Ucw.png" /></figure><p>Here we create the cube. THREE.Mesh creates a new cube with vertices and filled in faces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*O_EY-d_nEfRfEOGUhghDJQ.png" /></figure><p>Create a speed variable then rotate the cube on it’s y and z axis and then render it to the scene. At the end we call the runner init() to run our program.</p><p>Final product:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*ZI9H4L9B6XvhcEHiDm7CwQ.gif" /></figure><p>Links:</p><p>Three.js</p><ul><li><a href="https://www.jonathan-petitcolas.com/2013/04/02/create-rotating-cube-in-webgl-with-threejs.html">Create a rotating cube in WebGL with Three.js</a></li><li><a href="https://threejs.org/docs/#manual/introduction/Creating-a-scene">three.js / documentation</a></li></ul><p>React and three.js</p><p><a href="http://izzimach.github.io/demos/react-three-interactive/index.html">react-three Interactive Example</a></p><p>WebGL learning fundamentlas</p><p><a href="https://webglfundamentals.org/">WebGL Fundamentals</a></p><p><a href="http://learningwebgl.com/blog/?page_id=1217">http://learningwebgl.com/blog/?page_id=1217</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=478674956d38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SSH??]]></title>
            <link>https://medium.com/@seanconrad_25426/ssh-39f499a3d422?source=rss-5f0c3e67dc21------2</link>
            <guid isPermaLink="false">https://medium.com/p/39f499a3d422</guid>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Sean Conrad]]></dc:creator>
            <pubDate>Wed, 08 Aug 2018 13:58:30 GMT</pubDate>
            <atom:updated>2018-08-09T02:15:45.169Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*GUdNe8xTJImIFQMXwyUXoA.gif" /><figcaption>SHHHHHH</figcaption></figure><p>SSH (secure shell) is a cryptographic network protocol for network services to securely operate over an unsecured network. Basically, it can be used to encrypt the passing of your data from one computer to another.</p><p>But before SSH there was <a href="https://en.wikipedia.org/wiki/Telnet">Telnet</a>. Telnet was first created in 1969 and is short for ‘teletype network’. It was used to remotely connect to a server and provided access to a <a href="https://en.wikipedia.org/wiki/Command-line_interface">command-line interface</a> on a remote host, however you’d never want to send over any sensitive information. Every piece of data that was sent was unencrypted. Sending over your credit card information or SSN in clear text to the server is an easy snag for anyone using something like <a href="https://en.wikipedia.org/wiki/Wireshark">WireShark</a> to sniff or analyze the packets being sent.</p><p>In 1995 man from Finland named Tatu Ylönen came up with SSH after a password-sniffing attack at his university — and it was poised to replace Telnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*cUo3tE47XbCTqnQRwQlKew.jpeg" /></figure><p>SSH uses<em> Public key encryption </em>called<em> ‘RSA,’</em> which will generate two matching keys. One that is kept safe and hidden, <em>the private key</em>, and one that is handed out to computers, <em>the</em> <em>public key</em>. A computer with a public key can encrypt messages using the public key and send them to the computer with the private key and. Anyone who does not have the matching private key will be unable to read the encrypted message. The computer with the private key will be able to decrypt the messages. This creates an encrypted channel between computers or a <a href="https://en.wikipedia.org/wiki/Tunneling_protocol">tunnel</a>.</p><h3>What can you do with it?</h3><p>Common applications include connecting to a remote computer and opening a remote terminal session on Unix-like systems like Linux and MacOSX. In the below gif, I have a Linux virtual machine running on my computer and I’ve connected it to my local network. Using SSH, I remote in to the Linux computer, start a remote terminal session, and create a folder on the desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*k-siN2tjk1EovjwdViNS9Q.gif" /><figcaption>Example of using SSH to open a terminal session on a remote computer</figcaption></figure><p>Another application for SSH is to add security to applications that would normally be considered unsecure. In general, each TCP/IP application uses a dedicated port to communicate. HTTP is port 80, HTTPS is port 443, port 56356 for your application, and port 22 for SSH. But using port forwarding, many applications can use the single port 22 for security.</p><p>In use cases with Github, you use SSH to clone down repos, the data is encrypted and you are also authenticating yourself but it’s setup to be automatically.</p><h3>Personal use cases</h3><p>When I was first learning about these different technologies, I had a mentor at my previous job who set me up with a few projects. One was to set up a remote server that ran a webpage using Apache and to have it connected to a domain. I set up a remote server on <a href="https://www.digitalocean.com/">Digital Ocean</a>. Digital Ocean allows youto create what they call droplets, which are just remote Linux servers. In order for me to connect to the Linux computer, I had to generate an SSH key pair and place the public key on the remote server. Once I did that, I was able to create an SSH session to the remote Linux server and send over my websites that I had created.</p><h3>What are some downsides?</h3><ul><li>Files leaked by <a href="https://en.wikipedia.org/wiki/Edward_Snowden">Edward Snowden</a> indicate that the <a href="https://en.wikipedia.org/wiki/National_Security_Agency">National Security Agency</a> can sometimes decrypt SSH, allowing them to read the contents of SSH sessions.</li><li>Private keys can be compromised.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39f499a3d422" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>