This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lookup(obj /*Object */, props/* String */){ | |
if ( ! (obj && props)) { return undefined; } | |
var ps = props.split('.'); | |
var pointer = obj; | |
var val = undefined; | |
var i = 0, len = ps.length; | |
for(;i<len;i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Object utils""" | |
# coding=utf-8 | |
__author__ = 'Sriram Velamur' | |
import sys | |
sys.dont_write_bytecode = True | |
from mongoengine import (ValidationError, NotUniqueError, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseDocument(me.Document): | |
""" | |
Base document definition. | |
Defines the following attributes common to all derived models. | |
:attr created_at datetime: Creation time defaulting to UTC | |
:attr updated_at datetime: Updation time defaulting to UTC | |
Defines the following metadata for the derived models' support. | |
:attr allow_inheritance True: Required by Mongoengine. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIEW_ERRORS = { | |
'405': { | |
'status': 405, | |
'message': 'End point does not accept the method' | |
}, | |
'404': { | |
'status': 404, | |
'message': '{0} not found' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Handler(RequestHandler, object): | |
""" | |
Base request handler overridden with required decorators and data | |
members. | |
""" | |
def set_default_headers(self, *args, **kwargs): | |
"""Set API handler default headers""" | |
super(Handler, self).set_default_headers(*args, **kwargs) | |
self.set_header("Access-Control-Allow-Origin", "*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Tornadoweb bootstrapper. | |
""" | |
import sys | |
sys.dont_write_bytecode = True | |
import os | |
from datetime import datetime | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
sphinx.application | |
~~~~~~~~~~~~~~~~~~ | |
Sphinx application object. | |
Gracefully adapted from the TextPress system by Armin. | |
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
People who've been working with MongoDB, any suggestions on a migration tool for working with schema changes? | |
Something like South that is kind of the de facto standard with Django/migrations with Rails? | |
I saw a Node based gist earlier today but haven't checked it out though. | |
And for the context, this 3 year old ticket on Mongoengine's repository, the ODM we are currently working with. | |
A -1 and the repo maintainer's remarks on the request. | |
Migrations seem to be happening a lot and is usually a pain going through it with a solution that is otherwise seamless. | |
We would like to see if we can implement a parallel if any other developer has looked at it, irrespective of technology and port it | |
https://github.com/hmarr/mongoengine/issues/105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function getRemotes { | |
remotes=`git branch -r | grep -v HEAD` | |
local branches="" | |
for branch in $remotes; do | |
echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; | |
done | sort -r | head -n 1 | awk '{print $7}' | |
echo $branches | |
} |
OlderNewer