loading...

Second-ever hackathon experience

leanminmachine profile image leanminmachine ・4 min read

Took part in a hackathon!

Over the last weekend, I took part in a hackathon called HackRU at Rugters University, over at New Jersey.

At the beginning, I was really not looking forward to it. I had a really bad week emotionally (some minor fuck ups at work, being careless etc), and wanted nothing more than to just curl up in a ball and sleep off the weekend. Even though I learnt a lot through work like get used to ES6 syntax which i've known for quite a while but wasn't actively using in my projects (it has been around 2 months since i moved here to do an internship ... shall elaborate more in a separate post), i felt like i had a long way to go as a front end dev and felt slightly burnt out at this juncture. =(

Plus, the commute was pretty long (1 hour subway ride to Penn station, and 1 hour train ride to the venue). But I am so glad my friends encouraged me to go for it anyway (since we had already RSVP-ed a few weeks back and I was on the confirmed list of attendees).

Unfortunately (or expectedly) I ended up being the only one coding, cos I knowingly went to the hackathon with my friends who didn’t know how to code and wanted to just experience it.

I was pondering if i should stick to something familiar like build a mobile app, use Google Maps API etc, or try to learn something different. Thanks to my friends, I ended up building a Telegram bot with node.js, using a wrapper for API calls that i found on GitHub called botgram. A few hours in and I was regretting my decision because the wrapper uses a pretty old version of the Telegram API. The syntax was pretty easy to use though.

I also used request and ofc dotenv.

.env

I was pretty curious about .env as I was wondering how in the world do i use my env variables without directly passing in from the command line.

I was reading tutorials furiously at that point and they were telling me to pass in my bot token through the command line, which isn’t wrong per se.. but I needed something that would be able to do so by itself because I wanted to deploy on to a server online and just run a command like node index.js.

Tbh it was the first time I was more conscious of .env or environment file outside of work context. I also found out it was quite easy to setup the .env file by just :
TELEGRAM_BOT_TOKEN=TOKENHERE. Then I need to use dotenv.config()
and then destructure them to use it as such: const { TELEGRAM_BOT_TOKEN } = process.env;

Also, I had to remember to add it into my gitignore file. Which I conveniently forgot to do so for stuff like node_modules etc too :(

This is a way more informative read about this topic: Node.js Everywhere with Environment Variables! – Node.js Collection – Medium

Deploying live to Google Cloud

I wanted to try other services such as Now, since this tutorial recommends me to do so: Part 2 How to deploy a Telegram Bot using Now (Building a Bookmark Manager Bot series). However I think some changes in their services meant that I had to be constantly making requests You tried to create a Now 1.0 deployment. Please use Now 2.0 instead · Issue #1843 · zeit/now-cli · GitHub and there was no way to use Now 1.0 which was what the tutorials recommended. It was super frustrating because within a span of a few months, the recommendation became 'obsolete'... and i spent hours trying to figure out if there's a workaround but nope.

After trying several other services, I tried out Google Cloud. And it worked like a charm (well, iirc it ‘stops’ after 5 minutes of inactivity.. but at least that’s better off).

I just followed the instructions to setup via the Documentation for Google Cloud SDK:
Google Cloud SDK documentation  |  Cloud SDK  |  Google Cloud

  1. Download SDK
  2. Place unzipped SDK contents in your root directory for the app you want to deploy
  3. run command in correct directory: ./google-cloud-sdk/install.sh

After installing the SDK, install the Command Line Tool on your machine.

Quickstart: Using the gcloud Command-Line Tool  |  Cloud Functions Documentation  |  Google Cloud

Just follow steps on this website.

Also ensure before deploying app, you need to set up a app.yaml file where you state your runtime env: Example for nodejs

runtime: nodejs10

Conclude

Unfortunately, this project didn't win any prizes haha. But I really learnt quite a bunch of stuff during the hackathon, and it brought back fond memories of me coding overnight for school projects. I'm glad to have tried out something new, and I was quite amazed by how much i learnt in just a day. I felt motivated/recharged to go back to work to continue coding and learn more things!

*To improve on my project… *

  • use async await (unfortunately i couldn’t get the hang of it during the hackathon itself).
  • Implement Dialogflow for sentiment analysis
  • Just use Telegram API direct!

Posted on by:

Discussion

markdown guide
 

Hackathons are nice, but if you are in for to 'win' you got to get together with the right people vs non-coders. In my experience you need a thinker/entrepreneur/visionary and a good coder , and then the pitch'er if you combine all those 3 in a group, you are very well off to good start.

Agree that its nice to go to hackatons and meet other people etc, but some of those people are competitive and want exposure for the work they do.

At least that's my take on bigger hackatons.

 

The entrepreneur guy can do the pitch too, no? Haha, a designer would be great too so that the coder can focus on feature implementation.

I'm debating whether to go with my friends for the next hackathon or just go alone and try to find a team there. The hackathon that i went to -- most of the people seemed to form teams within their own friend groups.

 

I think its good to go with friends to support you and maybe mix up a bit ?

At last hackaton I meet 3 cool guys 3 devs and been friends with them ever since. Also we code together from time to time on some random ideas.

 

Hackathons are amazing. The last hackathon I took part, I was a solo programmer just like you and I learned a LOT of stuff. It's crazy what you can do when you're "under pressure"!

 

Agreed! What did you end up building?

 

An app using React Native (I had never used it before, now I use it all the time). You could take pictures from irregular streetlamps and send them to a web dashboard where you could have a more general view of everything. It was quite cool and a really fun experience