Skip to content

Instantly share code, notes, and snippets.

View vinay13's full-sized avatar
🎯
Focusing

Vinay Singh vinay13

🎯
Focusing
View GitHub Profile
bower install --save angular-masonry --force-latest
arr = [10,20,15,2,23,90,67]
def peakElement(arr):
n=len(arr)-1
cur = 0
prev = cur - 1
nxt = 1
newarr = []
@vinay13
vinay13 / mapss.txt
Last active August 29, 2016 21:42
maps
ogrin
gdal
slippy_tile
#usr/bin/python
#Decorators
import json
def as_json(func):
def wrapper(*args,**kwargs):
result = func(*args,**kwargs)
return json.dumps(result)
#usr/bin/python
#Decorators
def decorator_func(original_function):
def wrapper_func():
print('wrapper executed this before {}'.format(original_function.__name__))
return original_function()
return wrapper_func
#usr/bin/python
def currency(func):
def wrapper(*args,**kwargs):
return '$' + str(func(*args, **kwargs))
return wrapper
@currency
def price_with_tax(tax_rate_percentage):
li = [5,2,3,1,6,4]
for i in range(1,len(li)):
j = i
while j > 0 and li[j] < li[j-1]:
li[j], li[j-1] = li[j-1], li[j]
print i,j,li
j=j-1
#usr/bin/python
li = [5,2,3,1,6,4]
for k in range(0,len(li)-1):
j=1
for i in range(0,len(li)):
if li[i] > li[j]:
li[i],li[j] = li[j],li[i]
if j == len(li)-1:
import os
import requests
import bs4
from apscheduler.schedulers.blocking import BlockingScheduler
@vinay13
vinay13 / redis_server_commands.txt
Created July 26, 2016 04:08
redis server commands
for starting a redis server
redis-server /usr/local/etc/redis.conf
for running terminal internal redis commands
redis-cli
set mykey myvalue
get mykey