Skip to content

Instantly share code, notes, and snippets.

View acmisiti's full-sized avatar

andrew misiti acmisiti

  • Math and Pencil
  • Buffalo,NY
View GitHub Profile
@acmisiti
acmisiti / gist:184a607babab60f1c56a
Created March 15, 2016 14:22
search_commits.py
import os, sys
from time import mktime
from datetime import datetime
from git import Repo, InvalidGitRepositoryError
MAX_COMMITS_TO_GO_BACK = 200
BRANCH_TO_SEARCH = 'analytics-caching'
def display_commit(current_commit, previous_commit):
changed_files = []
var options = {
'success' : function(data) {
if(data.success) {
window.location.reload()
}
},
'error': function(){
}
}
var options = {
'success' : function(data) {
if(data.success) {
window.location.reload()
}
},
'error': function(){
}
}
TCB.EmployiiMainRouter = Backbone.Router.extend({
/* This is the main router in which everything will eventually go through */
routes : {
},
init: function(options) {
this.ajax = {};
this.ajax['rapid'] = $.manageAjax.create('rapid', {queue: false});
this.ajax['queue'] = $.manageAjax.create('queue', {queue: true});
TCB.EmployiiMainRouter = Backbone.Router.extend({
/* This is the main router in which everything will eventually go through */
routes : {
},
init: function(options) {
this.ajax = {};
this.ajax['rapid'] = $.manageAjax.create('rapid', {queue: false});
this.ajax['queue'] = $.manageAjax.create('queue', {queue: true});
(bookmarks)bookmarks # bin/build.sh
dropping old database ...
creating new database ...
migrating ....
Operations to perform:
Synchronize unmigrated apps: rest_framework, bookmarks, djcelery, users
Apply all migrations: admin, contenttypes, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Creating table celery_taskmeta
def dehydrate(self, bundle):
""" additional attributes for offerings that need to be added to the JSON responses """
from apps.offerings.models import RoadShowEvent
from apps.offerings.models import Document
###################################
# ATTENTION TO WHO THIS MAY CONCERN
#
# THIS IS A HUGE HACK, but i am over-writing the offering.id to something
# random just for admin (important), because stefano wants to display all watchlists
@acmisiti
acmisiti / gist:7763a7027f319d79cddc
Created April 16, 2015 19:45
unit tests to fix issue 952 rewire
Unit tests
@override_settings(CELERY_ALWAYS_EAGER = True, BROKER_BACKEND = 'memory')
def test_user_should_get_email_when_is_public_is_true_for_PRIMARY_OFFERINGS_ONLY(self):
"""
issue 952 fix
- if offering is primary and is_public goes from false to true then email should be sent
- if offering is not primary and is_public goes from false to true no email should be sent
"""
self.assertEqual(len(mail.outbox),0)
def get_reporting(data):
if not data:
return (0, 0)
unique_ids = list(set(data))
num_unique_vistors = len(unique_ids)
# create frequency of visits by user id dict
frequency = dict((key, len([k for k in data if k == key])) for key in unique_ids)
@acmisiti
acmisiti / gist:9a91c72ab15722f77dfb
Created February 11, 2015 17:02
fetcher autocomplete ajax call
on_click_send_individual_email : function(){
var valid = $("#js-template-form").validate().form();
if(!valid) return;
var contact_pk = localStorage.getItem('contact_pk');
if(!contact_pk || contact_pk === "null"){
alert("You must select someone to send the email to.");
return;
}