Skip to content

Instantly share code, notes, and snippets.

View vaibhav-jain's full-sized avatar
🏠
Working remotely @newpage solutions inc

vaibhav jain vaibhav-jain

🏠
Working remotely @newpage solutions inc
View GitHub Profile
@vaibhav-jain
vaibhav-jain / Procfile
Last active August 29, 2015 14:07 — forked from mabroor/Procfile
web: gunicorn -w4 -b0.0.0.0:$PORT app:app
application: <app-engine-id>
version: 1
runtime: python27
threadsafe: yes
api_version: 1
handlers:
- url: /
static_files: _build/html/index.html
upload: _build/html/index.html
@vaibhav-jain
vaibhav-jain / forms.py
Last active August 29, 2015 14:07 — forked from neara/forms.py
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from models import Sponsor, Sponsorship
class SponsorForm(ModelForm):
class Meta:
model = Sponsor
export PIP_DOWNLOAD_CACHE=/var/lib/jenkins/pip-cache
export AQUIPAGO_ENVIRONMENT=testing
make
env/bin/pip install -r requirements/base.txt --download-cache=/var/lib/jenkins/pip-cache --use-mirrors --timeout 1
env/bin/pip install -r requirements/project.txt --download-cache=/var/lib/jenkins/pip-cache --use-mirrors --timeout 1
env/bin/python runtests.py || :
env/bin/pylint --rcfile=.pylintrc aquipago --ignore=test > reports/pylint.txt || :
@vaibhav-jain
vaibhav-jain / archive.py
Last active August 29, 2015 14:07 — forked from Eccenux/archive.py
#!/usr/bin/env python
import os
import zipfile
"""
Helper class that lets one add whole directory contents.
License
--------------------

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@vaibhav-jain
vaibhav-jain / gist:3a648885b3a22d53a155
Created January 24, 2015 15:11
add all numbers in a table column
var sum = 0;
// use querySelector to find all second table cells
var cells = document.querySelectorAll("td:nth-of-type(2)");
for (var i = 0; i < cells.length; i++){
sum+=parseFloat(cells[i].firstChild.data);
}
@vaibhav-jain
vaibhav-jain / gist:9c86d7e32605249a35e4
Created January 24, 2015 17:01
render django form errors using bootstrap
<!-- DIV -->
{% if form.errors %}
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{% for field in form %}
{% if field.errors %}
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span>{{ field.label }}: {{ field.errors|striptags }}</span><br>
{% endif %}
{% endfor %}
@vaibhav-jain
vaibhav-jain / boostrap-youtube-modal.js
Created December 7, 2015 16:57 — forked from jawinn/boostrap-youtube-modal.js
BOOTSTRAP 3.0 - Open YouTube Video Dynamicaly in Modal Window. Allow setting width and height.
// REQUIRED: Include "jQuery Query Parser" plugin here or before this point:
// https://github.com/mattsnider/jquery-plugin-query-parser
$(document).ready(function(){
// BOOTSTRAP 3.0 - Open YouTube Video Dynamicaly in Modal Window
// Modal Window for dynamically opening videos
$('a[href^="http://www.youtube.com"]').on('click', function(e){
// Store the query string variables and values
// Uses "jQuery Query Parser" plugin, to allow for various URL formats (could have extra parameters)
@vaibhav-jain
vaibhav-jain / gist:e7b3ce38277a7c73611d
Created January 12, 2016 09:00 — forked from machristie/gist:1073967
iframe Tweet Button example
<iframe id="tweet-button" allowtransparency="true" frameborder="0" scrolling="no"
src="http://platform.twitter.com/widgets/tweet_button.html?via=marcus_christie&amp;text=Replace%20Me&amp;count=horizontal"
style="width:110px; height:20px;"></iframe>