Coding – E.B.'s Lab http://wp.ebislab.com Beautiful strange experiments Sun, 23 Dec 2018 21:38:14 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.15 Helpful Git Commands http://wp.ebislab.com/helpful-git-commands/ Wed, 05 Dec 2018 10:25:12 +0000 http://wp.ebislab.com/?p=566 Here are some git commands that I’ve used on my projects to make me look like  I knew what I was doing, when in reality….I was winging it.

This command reverts back to the cleanest canvas (the most working version) and delete any unwanted dependencies which will update the remote repo.

git reset --hard CommitId && git clean -f

and then

git push -f

 

This command helped me know which commit to revert to

git log --oneline

 

]]>
Sound frequency modification with javascript http://wp.ebislab.com/soundfrequencywithjavascript/ Sun, 21 Oct 2018 14:18:43 +0000 https://themify.me/demo/themes/ultra-portfolio/?p=28

About 3 months ago, I was listening to a podcast by Tariq Nasheed on the concept of sound frequency, and I hadn’t noticed till now, but I my mood is definetely affected by certain sounds and bases…(probably why I am very much attracted to trap music)

While studying for my certification, I revisited one of my favorite songs from one of the OG hip hop korean groups “Epic High” called Ignition. Funny thing is, I don’t remember the tempo being so fast. Though it was just as beautiful as I heard it the first time, I knew something was off. Scouting around the big Y web, all I could find was the same videos with the same tempo. Maybe my brain interpreted it a whole different way, or maybe I so badly wanted it to soothe my already hectic life and needed it to be slower. On youtube you have the option to slow down or speed up your desired video, but what happens when your desired speed falls between the listed speed?

So, with the power of javascript here is what I did:

On chrome, I loaded up the video page, opened up the Dev console and threw the following code in

document.getElementsByTagName(“video”)[0].playbackRate = x

My chosen variable for x is .875.

It only works for that particular video in that session. So if you refresh it, it will return back to normal.

]]>
Expanding on my passions http://wp.ebislab.com/perfect-lens/ Sat, 20 Oct 2018 14:20:57 +0000 https://themify.me/demo/themes/ultra-portfolio/?p=31

I spent this year participating in a front end web developer nano degree program sponsored by google and udacity. Even though I had alot going on in my life to even pay attention to what I was doing, I realized that it was indeed something I really liked, and I would have been really great in if I put my mind to it.

To be honest, I didn’t care much in completing it, but once Udacity announced that if we finished the first phase by a certain deadline, we would have a chance to be flown out to Cali for Google I/O event, that definetely sparked my interest to get it done. I didn’t get to complete the first phase by the deadline, so I did not qualify to be one of the lucky few to go to the event, but I was already 3/4 of the way through so why not finish it through.. or at least, attempt it.

Udacity was going to award approximately 5-10 thousand students the opportunity take the full nano degree, and because of my pride getting hurt on the first round, I thought “maybe, I’ll actually have a shot, even though I still don’t know squat.” And truth be told, I was actually very happy on how much I’ve expanded on my knowledge of css and html. As for javascript? I was avoiding it like a plague. I completed the program on time, with a few days to spare. After I finished, I told myself.  I’m done.

Then I received an email. A congratulations, you made it to the full degree email.

I was… shookethethhhhhh … I honestly did not plan on continuing, in fact, my summer was already planned with 3 months of back to back weekend trips.

Where was I going to find the time to get all the work completed?

When I had some spare time , I read all of the students’ testimonials, some made it through the next round, some where genuinely disappointed. I remember reading a student’s post on how terrible they felt because its as if the greatest opportunity was at an arm’s reach and they let it slip away. Agh… the feels!
I actually was going to send an email to the udacity’s support reps to take me off the list and give it to the person, but once again, sleep evaded me, I fell asleep and I forgot to do it.

By the time I realized, spring sped on through, and summer was here, and like I had planned, my weekends were packed full of trips, family obligations and just living my life. At the back of my mind though, I felt that maybe, I should look into this Udacity thing…”it’s not everyday that you get a scholarship opportunity, and here you are… wasting it…”. And you know what I did?

I went on and continued living my life.

Meanwhile, all of this “busy-ness” was as a direct result from my abusive work life. I hated my job and every single day I wished that I was run over by a truck or something. In late June-early- July, I partook on a retreat that  made me realize how empty my life has been and realized that all along I have been suffering from depression, and the only way I could remedy it was to run away every weekend to wherever land. When I came home each time the depression would intensify, and when I went away, it wouldnt fully disappear, but I had some relief.

After vacation season was over, I realized that I had to change my job, the main culprit of my depression… because if I didn’t, I probably wouldnt live to see the next year. But, where would I go? I’m not fully skilled. I don’t know anything, who would take me seriously? I’m worthless.

I spent the rest of july to mid august everyday after work, just staring at a wall as I sat on my bed. I just literally stood still. For the first time in my life, I just stood there at peace and had a conversation with myself.

These are the actual conversations I had with myself:

“Right now, you’re failing in school because your job is taking up your time, and your job is being abusive to you, and when you get home instead of doing your school work, you’re exhausted, you stress eat your depression away, and you have no self control… and the cycle repeats. Right now you can’t take 2 classes because you’ve taken them 3 times each, and you need to transfer to the more expensive university to retake those classes, but who’s to say you’re going to pass those classes, because once again your job won’t let you be great. You need to focus on something… something temporary that will at least allow you to get out of where you’re at, and go somewhere else… that will nurture you, and you will allow you to work what youre studying… but is this even possible?”

That evening, I decided to check my email to pay for my overdue at&t bill, and somehow it’s as if fate knew I needed a lil boost, Brenda from Udacity reached out with compassion and left some slack resources to get me started… if I wanted to get back in…and then I realized.

“This is the sign! You shall finish this! And at the end you can put these self doubts behind you”

That moment I allowed myself to be led by the little voice in the back of my head acting as the drill sergeant. She started as a tiny voice, as the days went by the voice grew louder and domineering to the point it started to feel like she was a separate entity but in my head for some reason. (im not crazy! I’ve been tested! )

First thing’s first. Disconnect from social media. No phone calls after working hours, heck, divert all important phone calls to your work phone and no phone calls after 5 pm. Third you will live and breathe this material every day for the next 8 weeks (I had 8 weeks left before the program ended). Sleep? What’s that, get up, no time for sleep! Practice being social, hit up some people for help. IDGAF if you dont know them, type help… heck, private message them, youtube, get help, and repeat.

Everyday felt like I was on bootcamp. Got home, went straight to the computer and started doing my work until my body got tired and fell asleep around 8-ish, then work up around 1-2 am and continued studying until 8 am in the morning where I quickly showered and went to work. As the course work itensified, my thirst for knowledge grew stronger, I started doing my course work at work when I could fit it. If I couldn’t, I made sure to seek out help in the morning from the slack community and the mentors, I would play around with some of the code snippets on chrome, and as soon as I got home and dropped my bags, I would plop in front of the computer and test out what I had played around with in the morning. Some days were pure misery as I felt I had wasted it on a concept that wasn’t working even though I researched it and made theoretical sense in my head. I spent alot of days like that, just waiting and waiting, and testing. Thank God for the mentors.

Udacity decided to pull a “you guys are working so hard, we’ll extend this for an extra 3 weeks because we believe in you”.  As generous as that was, I was using full force to finish it by the original deadline, because knowing the type of person I am, procrastination and is my greatest vice.

I finished the program in 9 weeks and 5 days. 5 days after the original due date , and I actually passively started a week before my second project in which I used to  kick off the project.

If I could go back and start this all over again, I’d join the 100daysofcode challenge and spend at most an hour a day from when the project started.

I’d dedicate 1-4 hours of my free time on the weekend playing around with it

And I’d definitely write a blog about it to keep everything documented.

 

]]>
How to deploy static site in Heroku http://wp.ebislab.com/herokusite/ Fri, 19 Oct 2018 14:21:39 +0000 https://themify.me/demo/themes/ultra-portfolio/?p=33

I would like to thank Stephen Chavez from my Grow with Google Nanodegree program for walking me through this. When I was researching how to deploy this static site to Heroku I got alot of complicated results, and all of them that I could find were published from students from the MWS track. Had me questioning wether I even learned anything while creating this project. Stephen walked me through his process, and that’s when we both realized that we had different versions of the project. FEND students’ objective was to make this as responsive to different displays and make it screen reader ready as well as enabling the service worker functionality. Whereas MWS students objective was focused on making it functional with the database backend, on top of what making it fancy and enabling service worker functionality as well.

After tinkling around, we came up with this:

  1. Create a package.json on the root directory that has npm support. Make sure it has
    "start": "node server.js"
  2. Create a server.js
  3. Deploy/Update your project onto github
  4. Create an Heroku account
  5. Create a new server and connect your GitHub repository in it.

If you get an error

  1. run the cmd node server.js in the same folder server.js is in by typing:
    node server.js
  2. run npm i express
  3. do node server.js again
  4. run npm i cors
  5. run node server.js
  6. I got a working on 80
  7. push it

I got some visuals, but for some reason the venues were not displaying. Remember server. js just serves the files to somebody
the browswer runs the code and the code makes a request at that address at port 8080, but there isnt anything at localhost.
When inspecting it in on the console I was getting localhost:8000/data/restaurants.json:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
I would create a new branch to deploy on github , so that I can refer back to the master branch on my local machine if I need to make edits in the future.

  1. So open up DBHelper.js
    1. Look for this line
      static get DATABASE_URL() {
      const port = 8000 // Change this to your server port
      return `http://localhost:${port}/data/restaurants.json`;
      }
    2. Replace it with
      static get DATABASE_URL() {
      let dataURL = "";
      if (location.protocol.indexOf("https") !== -1) {
      dataURL = `https://[your server url].herokuapp.com/data/restaurants.json`;
      } else {
      dataURL = `http://[your server url].herokuapp.com/data/restaurants.json`;
      }
      return dataURL;
      }

Make sure your service worker cache is cleared to  make sure you can see your changes on your site. It’s a frustrating process that cannot be omitted.

]]>