Skip to content

Instantly share code, notes, and snippets.

View pocha's full-sized avatar

Ashish Sharma pocha

View GitHub Profile
@pocha
pocha / rubyst-algo-ds-interview-cheatsheet.md
Last active March 20, 2018 04:45
Algo DS interview question cheatsheet for a Ruby guy

Intro

The sheet below is what I use to keep handy for quick revision of my algo-ds interview prep.

Given a binary tree, find the maximum path sum.

For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path does not need to go through the root.

Research

To improve weather.com, broadly the intent of the users need to be matched with what the site provides. Additionally, new market/user trends can be predicted. Putting trend prediction outside the scope of this doc currently.

What site provides

User acquisition could be direct, search or social. Weather.com has a pretty high direct visits so people are largely landing on the home page itself. Hence the home page seems to be the correct indicator of what the site thinks users want.

  1. Your city weather is the most prominent offering but without a call to action button.
  2. A sensational weather news story & call to action button to read more.
@pocha
pocha / mirror-binary-tree-without-recursion.rb
Created June 2, 2015 10:04
Mirror Binary Tree without recursion
def mirror(p)
while switched(p) == false
if switched(p.left) and switched(p.right)
right = p.right
p.right = p.left
p.left = right
right = nil
p.switched = true
p = p.parent
end

Sometime back we rolled out a new design for Codelearn . Details on our blog post

At Codelearn, we put out everything through an experiment cycle. Our experiments cycle is typically a week (or max two) where we quickly put together something that is 'demoable' & 'usable' without feeling too much embarrassed about it. We put it out & gauge metric.

For the new Codelearn design, I have gauged the Bounce Rate for Home Page as Landing Page from Google. It was reduced to 40% from 50% for the week. So we have the winner here. That means the design is here to stay.

That also means that the hacks need to be re-done the 'right' way. Karthik, a BITS Pilani fellow who created HTML/CSS for me, did a quick 2 day job & its pretty decent. But since the page needs to integrate with our existing stuff which is built on top of Bootstrap, the right approach is t

@pocha
pocha / blogger-cum-techie-at-Codelearn
Last active December 16, 2015 04:29
Looking for Blogger cum Techie who wants to learn to code (rather learn cutting edge web technologies)
I am Ashish, founder of Codelearn (www.codelearn.org) - a website in online learning to code space. There are numerous other sites there (most notably Codecademy) in the space. We did not like the way they teach to code because most hackers do not intend to learn to code that way. Hackers prefer to learn by building real apps. That is how we picked up technologies too. So at Codelearn, we emulated the process.
The course/tutorial at Codelearn starts with suggestion of an app to build. The rest of the course then teaches the essentials & step by step building. To facilitate quick learning - a **real** application development environment is provided *inside the browser* . We call it Codelearn Playground & it is our main USP. The user can *actually* build an app inside Playground. He can continue to do so without needing to install on his PC. Forever.
So that was the rosy part. Now comes the not-so-rosy one. After running Codelearn for around 8 months, we realized that the newbies who want to learn to code,
@pocha
pocha / parse-ansi-to-html.rb
Created March 8, 2013 07:31
Parsing ANSI color codes in Ruby to create appropriate HTML tags. If you are parsing the output of a command that is run on a bash Terminal, the output contain color codes. This is part of the new web Terminal I am working on for [Codelearn](www.codelearn.org) . Making it public as it might help somebody else who is looking out for similar resou…
ANSI_COLOR_CODE = {
0 => 'black',
1 => 'red',
2 => 'green',
3 => 'yellow',
4 => 'blue',
5 => 'purple',
6 => 'cyan',
7 => 'white'
}