Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Devesh Sawant dsaw

🎯
Focusing
Block or report user

Report or block dsaw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dsaw
dsaw / js_binding_rules.js
Created Oct 24, 2018
Little script to recap on this binding rules.
View js_binding_rules.js
function displaySome(blah)
{
console.log(this.blah);
console.log(this);
}
var blah = "suit yourself!";
@dsaw
dsaw / memoized.py
Created Aug 20, 2018
Memoized fibonacci in Python
View memoized.py
# https://dbader.org/blog/python-memoization
# Example learned from there
def memoize(func):
cache = dict()
def memoized_func(*args):
if args in cache:
@dsaw
dsaw / factorial.py
Created Aug 20, 2018 — forked from ChrisPenner/factorial.py
Tail Recursion in Python without Introspection
View factorial.py
from tail_recursion import tail_recursive, recurse
# Normal recursion depth maxes out at 980, this one works indefinitely
@tail_recursive
def factorial(n, accumulator=1):
if n == 0:
return accumulator
recurse(n-1, accumulator=accumulator*n)
@dsaw
dsaw / kdtree.py
Last active May 18, 2018
Straightforward implementation of 2-d tree in Python.
View kdtree.py
import unittest
## Kd-tree implementation
## 2d tree
## search, insert
class Node:
def __init__(self,x,y,cmp_x):
'''
@dsaw
dsaw / vimdiff.md
Last active May 3, 2018 — forked from mattratleph/vimdiff.md
vimdiff cheat sheet
View vimdiff.md

vimdiff cheat sheet

git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget LO or :diffget RE (the LO and RE are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
@dsaw
dsaw / c++Template.cpp
Created Dec 3, 2017 — forked from kodekracker/c++Template.cpp
Basic C++ Template for Competitive Programming
View c++Template.cpp
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
* Example:- $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
/******** All Required Header Files ********/
You can’t perform that action at this time.