Skip to content

Instantly share code, notes, and snippets.

Vaidik Kapoor vaidik

Block or report user

Report or block vaidik

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

Keybase proof

I hereby claim:

  • I am vaidik on github.
  • I am vaidik ( on keybase.
  • I have a public key ASCsz6K2PtUSx39aKlAwy6pQ46DZYVL1yxRWUMCiYvlXrAo

To claim this, I am signing this object:

vaidik /
Created Aug 21, 2014
Python: Outward Walk
import os
def outward_walk(bottom, func, arg=None):
Walks out of directory to the upper level directories in the path.
Usage is very similar to os.path.walk.
levels = bottom.split('/')
while len(levels) > 1:
vaidik / StackOverflow Question: Aggs on Nested Documents
Last active Aug 29, 2015
Displays how to use aggregations in Elasticsearch on documents with nested types
View StackOverflow Question: Aggs on Nested Documents
# Answer for:
curl -XPUT "http://localhost:9200/aggs/test/_mapping" -d'
"test": {
"properties": {
"doctxt": {
"type": "string"
"nested": {
View vunits.js
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free
* @author Lea Verou
(function() {
if(!window.StyleFix) {
View gist:6321504
set -e
echo "Plug in your device"
adb wait-for-device
echo "Found device"
#dir=$(mktemp -d -t revision)
dir=$(mktemp -d -t revision.XXXXXX)
cd $dir
adb pull /system/b2g/omni.ja &>/dev/null || echo "Error pulling gecko"
adb pull /system/b2g/webapps/ &> /dev/null || echo "Error pulling gaia file"
vaidik / gist:5905762
Last active Dec 19, 2015
Get element's source only in Selenium or Marionette. Both Selenium and Marionette have APIs to get source of the entire page but not just the source of the `WebElement` or `HTMLElement`. This utility function fills that gap.
View gist:5905762
def element_html(driver, elements):
"""Return source of a particular HTML element on the page.
:param driver: webdriver or marionette object - the object you use
to drive your webdriver or marionette tests.
:param elements: Webdriver.remote.webelement.WebElement object or
marionette.marionette.HTMLElement object or
a list of WebElement or HTMLElement objects
import json
import requests
import unittest
from time import time
def get_status_code(url):
response = requests.get(url, verify=False, allow_redirects=True)
return response.status_code
View README.markdown

Hyde publisher plugin for publishing content to Github Pages (User Pages).


  • Make sure that the hyde project lives in your dev branch. master branch, in case of user github pages, is left for serving static files.
  • Create an orphan master branch.
View Package Control.sublime-settings
"auto_upgrade_last_run": null,
"All Autocomplete",
"Case Conversion",
"Clipboard Manager",
class ReloaderEventHandler(FileSystemEventHandler):
Listen for changes to modules within the Django project
On change, reload the module in the Python Shell
Custom logic required to reload django modules
Due to the singleton AppCache, which caches model references.
For those models files, we must clear and repopulate the AppCache
def __init__(self, *args, **kwargs):
You can’t perform that action at this time.