Skip to content

Instantly share code, notes, and snippets.

View NahimNasser's full-sized avatar

Nahim Nasser NahimNasser

View GitHub Profile
0xFd63f136403252270fC4aCD1be21b8078aE59E25
@NahimNasser
NahimNasser / gist:5229060
Created March 23, 2013 19:29
Quick solution for assignment 2
import requests
from django.core.management import setup_environ
from ymcproject import settings
setup_environ(settings)
import simplejson as json
from experiments import models
def _get_dict_for_one_page_of_products(page):
response = requests.get("http://lcboapi.com/products?per_page=100&page=%d" % page)
lcbo_data = json.loads(response.content)
@NahimNasser
NahimNasser / weekly_git_log_generator.py
Created February 12, 2013 18:39
Git log summary, week by week for your entire project.
"""
Outputs a week by week commit log with one line commit messages for your entire git repository
from start to finish
"""
import commands
import datetime
status, start_date = commands.getstatusoutput("git log --date=short --format='%cd' --reverse | head -1")
status, end_date = commands.getstatusoutput("git log --date=short --format='%cd' -1")
class Node(object):
"""
Tree node: left and right child + data which can be any object
"""
def __init__(self, data):
"""
Node Constructor
@param data node data object
"""
self.left = None
@NahimNasser
NahimNasser / truncationView.js
Created November 13, 2012 20:11
Javascript Backbone Marionette Truncation View
View.TruncationView = Backbone.Marionette.View.extend({
limit: 3,
events: {
'click .btn_less': 'truncateClicked',
'click .btn_more': 'unTruncateClicked'
},
truncateClicked: function(e){