Skip to content

Instantly share code, notes, and snippets.

View pocha's full-sized avatar

Ashish Sharma pocha

View GitHub Profile
@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'
}
@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,

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 / 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

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 / 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.

def flatten(a)
out = []
if !a.kind_of?(Array)
puts "not an array"
return -1
end
a.each do |val|
out += _flatten(val)
end
out
@pocha
pocha / TestNG Griggi setup
Last active September 14, 2016 06:11 — forked from anonymous/TestNG Griggi setup
TestNG Griggi setup
Install IDE
https://eclipse.org/downloads/packages/eclipse-ide-java-developers/mars2
Install testNG plugin for eclipse:
http://testng.org/doc/download.html
Verify if plugin is installed:
http://wiki.eclipse.org/FAQ_How_do_I_find_out_what_plug-ins_have_been_installed%3F
If its first time with Eclipse, you need to add JRE to the project as well . Without this, you will see errors like java.lang.Object not resolved because java isnt accessible.

###Question###

Describe the most significant/impactful continuous improvement project that you have led? (What was the catalyst to this change and how did you go about it?

###Answer###

Problem Statement

This is about Griggi, a side project I & my partner have been working on since Mid 2015 . The motivation behind the project came to me when I use to travel to my hometown & the lack of broadband in my home made me think if I could haved used the WiFi of my neighbour in an abuse free way & without the hassle of disturbing them / asking them the WiFi password

@pocha
pocha / leetcode-answers.md
Last active April 3, 2018 11:48
Algo-DS interview prep in a glance. Leetcode questions & their answers compiled in one place.

1. Two Sum

Total Accepted: 372574
Total Submissions: 1273263
Difficulty: Easy
Contributors: Admin

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution.