<?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 Kanishk Srivastava on Medium]]></title>
        <description><![CDATA[Stories by Kanishk Srivastava on Medium]]></description>
        <link>https://medium.com/@KanishkSrivastava?source=rss-c2a48eeef6d4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OmhjNsdnryHb1-9y05NfXg.jpeg</url>
            <title>Stories by Kanishk Srivastava on Medium</title>
            <link>https://medium.com/@KanishkSrivastava?source=rss-c2a48eeef6d4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:05:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@KanishkSrivastava/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[Upload Files To S3 Using Lambda and API Gateway (SERVER LESS)]]></title>
            <link>https://medium.com/@KanishkSrivastava/upload-files-to-s3-using-lambda-and-api-gateway-severless-bb8d8cdc30e4?source=rss-c2a48eeef6d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb8d8cdc30e4</guid>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Kanishk Srivastava]]></dc:creator>
            <pubDate>Sun, 23 Sep 2018 07:13:50 GMT</pubDate>
            <atom:updated>2019-03-06T04:40:47.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*J0h4171CHoRcNdNWRHxfAw.png" /></figure><h4>Uploading files to S3 can be sometimes tough especially if you have a serverless project.</h4><p><strong>We will be using pre-signed URLs, Lambda Functions and API Gateway for this process.</strong></p><h4>STEP 1</h4><p>Create a S3 bucket where you want to store your files.Also edit the <strong>CORS </strong>configuration of the bucket.</p><pre>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;CORSConfiguration xmlns=”http://s3.amazonaws.com/doc/2006-03-01/&quot;&gt;<br>&lt;CORSRule&gt;<br> &lt;AllowedOrigin&gt;<em>WRITE ORIGIN OR PUT * FOR TESTING</em>&lt;/AllowedOrigin&gt;<br> &lt;AllowedMethod&gt;GET&lt;/AllowedMethod&gt;<br> &lt;AllowedMethod&gt;PUT&lt;/AllowedMethod&gt;<br> &lt;AllowedHeader&gt;<em>WRITE ORIGIN OR PUT * FOR TESTING</em>&lt;/AllowedHeader&gt;<br>&lt;/CORSRule&gt;<br>&lt;/CORSConfiguration&gt;</pre><p>The above configuration will allow GET and PUT requests to intract with your bucket, form the web browser.</p><h4><strong>STEP 2</strong></h4><p>Create policies and role for Lambda via AWS IAM, so that Lambda can generate the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W34EjMWaP-TH_BZhRD0XVQ.jpeg" /><figcaption>IAM POLICY</figcaption></figure><p>Now add this policy to a role for Lambda, also add <a href="https://console.aws.amazon.com/iam/home?region=ap-south-1#/policies/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2Fservice-role%2FAWSLambdaBasicExecutionRole">AWSLambdaBasicExecutionRole</a> to the Lambda role, so that you can monitor your function on cloud watch.</p><h4><strong>STEP 3</strong></h4><p>Create a Lambda function, attach the above role to it.The following code takes the filename (key) from the API Gateway and generates a signedURL.</p><pre>const AWS = require(&#39;aws-sdk&#39;);<br>const s3 = new AWS.S3({signatureVersion: &#39;v4&#39;});</pre><pre>exports.handler = async (event,context) =&gt; {<br>  const bucket = process.env.BUCKET_NAME;<br>  const key = event.key;<br>  const params = {<br>    Bucket: bucket,<br>    Key: key,<br>    ContentType: &#39;multipart/form-data’,<br>    Expires: 60<br>  };<br>  try{<br>    const signedURL = await s3.getSignedUrl(’putObject’, params);<br>    const response = {<br>        err:{},<br>        body:&quot;url send&quot;,<br>        url:signedURL<br>    };<br>    return response;<br>  }catch(e){<br>        const response = {<br>        err:e.message,<br>        body:&quot;error occured&quot;<br>    };<br>      return response;<br>  }<br>};</pre><h4>STEP 4</h4><p>Create an API Gateway, and make this API a trigger to above created lambda function. Ensure the CORS setting of the API is updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6oY95Y6F1JriXx3QKbrtw.jpeg" /></figure><h4>STEP 5</h4><p>Testing the FILE upload.<br>First make a POST request to the API, with filename (EX- File.txt) as body of the request i.e (key:File.txt), the API will see this filename and Lambda function will generate a URL according to the filename and send this URL back as response.<br>We have to then send a PUT request to the received URL with correct headers. Body of the request will be having the file itself as multipart/formdata.</p><pre>const options = {<br> headers: {<br>  &quot;Content-Type&quot;: &quot;multipart/form-data&quot;<br> }<br>};<br>// inside an async function<br>const res = await axios.put(&quot;URL&quot;,Your-File,options);<br>console.log(res);</pre><h4>ALL DONE</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb8d8cdc30e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get your current Weather]]></title>
            <link>https://medium.com/@KanishkSrivastava/get-your-current-weather-f7a00ea5126e?source=rss-c2a48eeef6d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7a00ea5126e</guid>
            <category><![CDATA[geolocation]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[weather-apps]]></category>
            <dc:creator><![CDATA[Kanishk Srivastava]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 11:43:14 GMT</pubDate>
            <atom:updated>2018-01-02T12:22:47.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JWoVZiRlt7xW3q8Lz2_pjw.png" /></figure><h4>Using Geo Location, Open Weather API and React.js</h4><h4>Step 1:</h4><p>You have to first get your current location’s latitude and longitude and change the state of your component when the locations is fetched.</p><pre>import React, { Component } from ‘react’;</pre><pre>class LatLong extends Component{<br> constructor(props) {<br> super(props);</pre><pre>this.state = {<br> Lat:’Loading’,<br> Long:’Loading’<br> }<br> }<br> componentDidMount() {<br> var that = this;<br> navigator.geolocation.getCurrentPosition(<br> function(position) {<br> that.setState({<br> Lat: position.coords.latitude,<br> Long: position.coords.longitude<br> });<br> that.props.onPass(that.state.Lat,that.state.Long)<br> },<br> function (error) {</pre><pre>},<br> {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}<br> )<br> }<br> render () {</pre><pre>return &lt;div&gt;&lt;/div&gt;<br> }<br>}<br>export default LatLong;</pre><h4>Step 2:</h4><p>Now after you have got your current location, you have to send this value to the Open Weather API.</p><p>Here I will be using AXIOS for this.You can learn more about axio <a href="https://medium.com/codingthesmartway-com-blog/getting-started-with-axios-166cb0035237"><strong>here</strong></a></p><pre>var axios = require(&#39;axios&#39;);</pre><pre>const OPEN_WEATHER_MAP_URL = &#39;<a href="http://api.openweathermap.org/data/2.5/weather?&amp;units=metric&amp;APPID=72ca98debac801064ef290f07aaad178&#39;">http://api.openweathermap.org/data/2.5/weather?&amp;units=metric&amp;APPID=YOUR API KEY&#39;</a>;</pre><pre>module.exports = {<br>  getTemp: function (Lat,Long) {<br>    var requestUrl = `${OPEN_WEATHER_MAP_URL}&amp;lat=${Lat}&amp;lon=${Long}`;</pre><pre>return axios.get(requestUrl).then(function (res) {<br>      if (res.data.cod &amp;&amp; res.data.message) {<br>        throw new Error(res.data.message);<br>      } else {<br>        return res.data;<br>      }<br>    }, function (res) {<br>      throw new Error(res.data.message);<br>    });<br>  }<br>}</pre><h4>Step 3:</h4><p>After the data has been fetched you have to pass it to the parent component and then to its child component.</p><pre>import React, { Component } from &#39;react&#39;;<br>import ReactDOM from &#39;react-dom&#39;;<br>import LatLong from &#39;LatLong&#39;;<br>import DisplayTemp from &#39;DisplayTemp&#39;<br>import OpenWeatherAPI from &#39;OpenWeatherAPI&#39;<br>class App extends Component {</pre><pre>constructor(props){<br>    super(props);<br>    this.state ={<br>      Lat:&#39;&#39;,<br>      Long:&#39;&#39;,<br>      Temp:&#39;Loading&#39;<br>    }<br>    this.onPass = this.onPass.bind(this)<br>  };</pre><pre>onPass(Lat,Long) {<br>    var that = this;</pre><pre>OpenWeatherAPI.getTemp(Lat,Long).then(function (data) {<br>      that.setState({<br>        Lat: Lat,<br>        Long: Long,<br>        Temp: data.main.temp,<br>        Name: data.name<br>      });<br>    },<br>    function (errorMessage) {<br>        alert(errorMessage);<br>    });<br>  }</pre><pre>render(){<br>    return(<br>      &lt;div&gt;<br>        &lt;LatLong onPass = {this.onPass} /&gt;<br>        &lt;DisplayTemp Temp = {this.state.Temp} Name = {this.state.Name} Lat = {this.state.Lat} Long = {this.state.Long}/&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}<br>ReactDOM.render(&lt;App /&gt;, document.querySelector(&#39;#app&#39;));</pre><h4>Step 4:</h4><p>The data has been passed to the display component above,now we have to handle the data in it.</p><pre>import React, { Component } from &#39;react&#39;;<br>require(&#39;style!css!DemoStyle&#39;);<br>class DisplayTemp extends Component{</pre><pre>render(){<br>    var {Temp, Lat, Name, Long} = this.props;<br>    if(Temp==&#39;Loading&#39;){<br>      return &lt;div className=&#39;loading&#39;&gt;Loading Your Local Weather...&lt;/div&gt;<br>    }<br>    else {<br>      var Lat = Math.round(Lat)<br>      var Long = Math.round(Long)<br>      return(<br>        &lt;div className=&#39;display-weather&#39;&gt;<br>          It is {Temp} &amp;#8451; at {Name}, Latitude: {Lat} and Longitude: {Long}<br>        &lt;/div&gt;<br>      )<br>    }</pre><pre>}<br>}<br>export default DisplayTemp;</pre><p>Now we are able to display the current weather.</p><p>The state will change when</p><ul><li>When geoLocation fetches latitude and longitude (child component).</li><li>When Open Weather API fetches weather (parent component) which will update our Display Temperature method.</li></ul><p>Thank You.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7a00ea5126e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hand Writing Effect through CSS3 and Adobe Illustrator]]></title>
            <link>https://medium.com/@KanishkSrivastava/hand-writing-effect-through-ccs3-and-abobe-illustrator-9cc45b1f80e7?source=rss-c2a48eeef6d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cc45b1f80e7</guid>
            <category><![CDATA[svg]]></category>
            <category><![CDATA[handwriting]]></category>
            <category><![CDATA[css-animation]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[cursive-handwriting]]></category>
            <dc:creator><![CDATA[Kanishk Srivastava]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 06:26:19 GMT</pubDate>
            <atom:updated>2019-03-06T11:32:36.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*1vjLmqaNUXOJQHcMuBAUng.gif" /></figure><h4>You can put this effect on your HTML pages. It does not limits to text but can be any svg image or an icon.</h4><p>This effect can be created with any font and you can write any text you want.</p><h4><strong>Step 1:</strong></h4><p>Open Illustrator and write a text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHqjkYObj1rp-kaeJxGEew.jpeg" /></figure><h4>Step 2:</h4><p>Create outline of your text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MPQ3zpoLCX-61gVM-EhgQ.gif" /></figure><h4>Step 3:</h4><p>Set the fill to none and give it a slight stroke.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zmD8DWBxhZaswIlf31dew.gif" /></figure><h4>Step 4:</h4><p>Remove the group layer and rename the layer accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BaiVS782dBLPNm200yS9_g.gif" /></figure><h4>Step 5:</h4><p>Draw path inside each word according to the way you want to animate, with the help of pen tool.Remember to start and end little outside the letter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WFZcVtQl_GqEfqr7FKs-Lg.jpeg" /></figure><h4>Step 6:</h4><p>Rename the path created (as h-path) and move its layer just below its corresponding letter.</p><p>Select both the letter and path, then create a clipping mask and rename it (h-grp)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qp-U7JRyS4wDzAIWUfOAfw.gif" /></figure><h4>Step 7:</h4><p>Now, increase the stroke size of the path till it completely fills the mask.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*evOuhDuSFeE-mlMd3K3gDA.gif" /></figure><h4>Step 8:</h4><p>Do this for all the letters i.e draw path and make their clipping mask.Not to make this repetitive i will do it for the letter h only and proceed further.</p><h4>Step 9:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*Q2DbRYqzEX_a3Ix7pHXBRA.jpeg" /></figure><p>Now, you have done all the letters and made their clipping mask.All you have to do next, is to create SVG and animate it over the path created.</p><p>Go to file&gt;Export&gt;Export As&gt;(svg). Hit OK</p><p>You have to choose the above options shown in the photo.</p><p>Now press the show code button and copy the code.</p><p>A clip path and corresponding path will be created for every letter. We have to animate the path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FoCdOgFwrZnac1hxxauKpw.jpeg" /><figcaption>clipPath of the letter h created above</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zh7s0v6649PN2UemtgiLsA.jpeg" /><figcaption>animation path of letter h</figcaption></figure><h4>Step 10:</h4><p>It is time to animate the SVG path.</p><p>You can learn more about SVG animation<em> </em><a href="https://css-tricks.com/svg-line-animation-works/"><em>here.</em></a></p><p>First, we have to increase stroke-dashoffset to a value and animate it to zero.</p><p>Now, add a class {class = “animate”}to your path which is to be animated in your code editor. Now we can write the following code for the above talked animation.</p><pre>.animate{<br> stroke-dasharray: 300;<br> stroke-dashoffset: 300;<br> animation: dash 5s linear forwards;<br>}</pre><pre><a href="http://twitter.com/keyframes">@keyframes</a> dash {<br>to {<br> stroke-dashoffset: 0;<br> }<br>}</pre><h3>Ta-Da hit refresh and see the magic.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*uQzGwDCUM0NxQY3S42Vs5A.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cc45b1f80e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>