Skip to content

Instantly share code, notes, and snippets.

Hussain Tamboli hussaintamboli

Block or report user

Report or block hussaintamboli

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
hussaintamboli / Web Snippet - Basic
Last active Sep 14, 2018
Web Snippets for Pinn
View Web Snippet - Basic
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
View Fetch instead of XMLHttpRequest
fetch('').then(function(response) {
return response.json();
}).then(function(data) {
}).catch(function(err) {
hussaintamboli / Python3 Virtualenv
Last active Feb 14, 2018 — forked from pandafulmanda/Python3 Virtualenv
Setting up and using Python3 Virtualenv on Mac
View Python3 Virtualenv

Python3 Virtualenv Setup

  • Python 3
  • Pip 3
$ brew install python3
hussaintamboli /
Created Jun 22, 2016 — forked from zhenyi2697/
Python: urlparse demo
# The urlparse module provides functions for breaking URLs down into their
# component parts, as defined by the relevant RFCs.
from urlparse import urlparse
parsed = urlparse('http://user:pass@NetLoc:80/path;parameters?query=argument#fragment')
hussaintamboli / Custom response in Flask
Last active Sep 9, 2019
Return a Custom response in flask restful API
View Custom response in Flask
from flask import Response, jsonify
import json
from flask_restful import Resource
class Api(Resource):
def post(self):
response = Response(
hussaintamboli / Angularjs paginate filter
Last active Aug 29, 2015
A paginate filter in angularjs for maintaining pagination window with current page in the middle
View Angularjs paginate filter
.filter('paginate', function() {
return function(arr, page, END, START, WINDOW) {
if (typeof(START)==='undefined') START = 0;
if (typeof(WINDOW)==='undefined') WINDOW = 5;
var start = Math.floor(page - WINDOW/2);
var end = Math.floor(page + WINDOW/2);
if (start >= START && end <= END) {
hussaintamboli / Python Pagination
Last active Aug 29, 2015
Code snippet for basic Pagination logic in python
View Python Pagination
START, END, WINDOW = 0, 15, 5
def pages(page):
start = page - WINDOW/2
end = page + WINDOW/2
if start >= START and end <= END:
return range(start, end+1)
if start <= START:
hussaintamboli / jQueryBenchmarkingDynamicInputElementCode
Last active Aug 29, 2015
jQuery: adding <input> elemnts to a div. 1. by adding tags 2. by adding input elements. Which way is faster? Also This code seems to run in lesser time in Google Chrome than Firefox. Why? You can test it in
View jQueryBenchmarkingDynamicInputElementCode
<script src="" type="text/javascript"></script>
<script type="text/javascript">
jQuery(function ($) {
// code1
var start = +new Date();
var html = '';
for (var i = 0; i < 1000; i++) {
$('#container1').append('<input name="text' + i + '"' + ' value="' + i + '" />');
hussaintamboli / JQuery : Edit, Save and Cancel scenario
Created Apr 29, 2014
The right way of Ajax for Edit, Save and Cancel scenarios for Web
View JQuery : Edit, Save and Cancel scenario
<script src="" type="text/javascript"></script>
<span id="spanId" style="float:left;"> Guest </span>&nbsp;
<input type="text" id="inputField" style="display:none;">
<input type="submit" value="Edit" name="editButton" id="editButton" onclick="editIt();" />
<input type="submit" value="Save" id="saveButton" style="display:none;" onclick="saveIt(this);">
<input type="submit" value="Cancel" id="cancelButton" style="display:none;" onclick="$('#saveButton').hide();$('#editButton').show(); $(this).hide();$('#inputField').hide(); $('#spanId').show();">
hussaintamboli / Calendar in PHP
Created Mar 14, 2014
A Calendar in PHP. Kind of looks like Github's activity calendar but vertical.
View Calendar in PHP
$year = '2014';
$start = date("$year-01-01");
$end = date("$year-12-t");
$week = array();
$month = array();
$i = 0;
print_r("Calendar: $year\n\n");
You can’t perform that action at this time.