Skip to content

Instantly share code, notes, and snippets.

@prasoon2211
prasoon2211 / suffix_array.py
Last active November 12, 2019 08:15
Python suffix array
def sort_bucket(s, bucket, order):
d = defaultdict(list)
for i in bucket:
key = s[i:i+order]
d[key].append(i)
result = []
for k,v in sorted(d.iteritems()):
if len(v) > 1:
result += sort_bucket(s, v, order*2)
else:
@prasoon2211
prasoon2211 / string_chaining.cpp
Created October 29, 2015 16:21
String chaning
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#define PR cout << 11 << endl;
using namespace std;
string arr[50010];
@prasoon2211
prasoon2211 / gist:ccfa6e6314f9637f9cd8
Created July 17, 2015 17:58
challenges/bfsshortreach
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
class Graph {
@prasoon2211
prasoon2211 / application.md
Last active August 29, 2015 14:17
Metrics and Graphs support for Buildbot: GSoC 2015 application

Metrics and Graphs for Buildbot

Personal Details

Project Description

@prasoon2211
prasoon2211 / dev_apache
Created February 6, 2015 14:01
Developing with apache
If your server documents are in /home/$USER/public_html directory you need to run
sudo chown -R www-data:www-data /home/$USER/public_html
to give ownership of the DocumentRoot folder to the user www-data and group www-data.
Then you can add yourself to the group www-data
sudo adduser $USER www-data
@prasoon2211
prasoon2211 / ctags-gen.sh
Created January 18, 2015 13:48
PHP vim ctags
#!/bin/bash
cd /path/to/framework/library
exec ctags-exuberant -f ~/.vim/mytags/framework \
-h \".php\" -R \
--exclude=\"\.svn\" \
--totals=yes \
--tag-relative=yes \
--PHP-kinds=+cf \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
@prasoon2211
prasoon2211 / chatapp_1.md
Last active August 29, 2015 14:04
Chat application in Node.js: Part 1

Making a chat application in nodejs : Part 1

Nodejs is a new development platform that focusses on developing realtime applications. In this tutorial, we'll be learning how to create a full-fledged chatting application, complete with support for multiple users and multiple chat rooms. We will start slow at first and slowly build up to our goal. This is the first of a multipart turotial series.

What exactly is Node.js?

Before we start, let us first clarify what node.js is, exactly. Is it a language? No. In fact, node.js is a runtime environment that can run JavaScript code. Also, it is build on top of Google's V8 JavaScript engine. Simply put, this means that Node.js is fast. Fast enough that you can write a web server in it and be confident that it'll handle loads just as well as a server written in C.

Node.js is good for writing application that require constant, or almost constant communication with the server. The thing that separated node f

@prasoon2211
prasoon2211 / parallax.md
Last active August 29, 2015 14:03
Parallax scroll using jQuery: Explained

Parallax Scrolling

Parallax scrolling is a relatively new trend in web design. With this effect, you can create an illusion of depth on your webpage. Parallax works by making the background of the webpage scroll at a slower speed that the foreground, thus giving the scene a perceived depth.

So how do we do this? Well, it's quite simple really. Whenever a users scrolls on the page, we'll calculate how much the page has been scrolled. We'll then scale down this 'scroll-height' and move the background image up or down accordingly.

Here's the result we wish to achieve: Parallax1

Don't worry though, this is just a gif image. The actual result is completely smooth.

@prasoon2211
prasoon2211 / blue sugar
Created June 14, 2014 16:07
BLue desiign
* {
font-family: dejavu !important;
}
.fa {
font-family: FontAwesome !important;
}
.nav-pills > li > a:hover {
color: #0d93d2;
@prasoon2211
prasoon2211 / green_sugar
Created June 14, 2014 16:05
Green design
* {
font-family: dejavu !important;
}
.fa {
font-family: FontAwesome !important;
}
.nav-pills > li > a:hover {
color: #0d93d2;