Skip to content

Instantly share code, notes, and snippets.

@prasoon2211
prasoon2211 / gist:5313156
Created April 4, 2013 19:00
Sort facebook friend list, closest friend first.
An algorithm to sort a person's friend list, closest friends first.
Problem: Given the publicly available information on facebook, how to
sort the friend list in an order that list closest/most relevant friends
first?
We are assuming the following things are available (in no particular order):
1. Location information: All the locations
2. Schools/University attended
3. Birthday
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(mouse-wheel-mode t)
;; ========== Place Backup Files in Specific Directory ==========
;; Enable backup files.
(setq make-backup-files t)
@prasoon2211
prasoon2211 / .emacs
Last active December 20, 2015 12:39
Emacs config
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(mouse-wheel-mode t)
;; ========== Place Backup Files in Specific Directory ==========
;; Enable backup files.
(setq make-backup-files t)
@prasoon2211
prasoon2211 / .vimrc
Created August 1, 2013 16:49
Vi config
set incsearch " BUT do highlight as you type you search phrase
set laststatus=2 " always show the status line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines betweens rows
set list " we do what to show tabs, to ensure we get them out of my files
set listchars=tab:>-,trail:. " show tabs and trailing
set matchtime=5 " how many tenths of a second to blink matching brackets for
set nohlsearch " do not highlight searched for phrases
set nostartofline " leave my cursor where it was
set novisualbell " don't blink
@prasoon2211
prasoon2211 / .xmodmap
Created August 1, 2013 16:50
Switch Ctrl and Caps
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
@prasoon2211
prasoon2211 / pytrace
Last active August 29, 2015 13:56
pytrace
import sys, linecache
def tracefunc(frame, event, arg, indent=[0]):
if event == "call" or event == "return":
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if filename == "<stdin>":
filename = "traceit.py"
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
import sys
from gi.repository import Gtk, Gdk, WebKit
class BrowserTab(Gtk.VBox):
def __init__(self, *args, **kwargs):
super(BrowserTab, self).__init__(*args, **kwargs)
go_button = Gtk.Button("go to...")
go_button.connect("clicked", self._load_url)
self.url_bar = Gtk.Entry()
@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;
@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 / 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.