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
We use the code from this file to turn latex into pdf:
https://github.com/MikeHungerford/thecontractbox/blob/production/thecontractbox/tools/make_pdf.py
and here is an example of code that renders it:
https://gist.github.com/acmisiti/5a3c5a8ae7a65923ea52
If you want full examples then you can look in documents/mixins.py EmployiiDocumentMixin.
@acmisiti
acmisiti / gist:5a3c5a8ae7a65923ea52
Created October 7, 2014 17:46
example rendering LATEX document to PDF
from apps.staff.models import MHRBoxEmployee
employee = MHRBoxEmployee.objects.get(id=uid)
params = {
'employee' : employee,
}
# render the document with latex
@acmisiti
acmisiti / gist:178994510b0caa180322
Created June 20, 2014 20:37
how i create models now. i think it looks better
kwargs = {
'type_of_agreement' : SERVICE_LEVEL,
'cid' : company.id,
'title' : 'Terms of Service',
'signature_is_required' : True,
'has_been_signed' : False
}
agreement = MAgreement.objects.create(**kwargs)
@acmisiti
acmisiti / gist:9331044
Created March 3, 2014 18:10
Pandas bug + creating a list of dataframes from paystubs
@login_required
@json_view
def api_generate_941_report(request):
""" Generate 941 report """
params = {}
params['success'] = True
params['is_valid'] = True
company_id = request.REQUEST.get("company_id")
if company_id and request.user.is_superuser:
@acmisiti
acmisiti / gist:9259856
Created February 27, 2014 21:23
backbone save on success callback
that.options.employee.save({
payment_method : 'direct-deposit',
payment_divide_type : that.payment_divide_type,
},{
patch : true,
success:function(model, response) {
that.on_reset_page();
},
});
@acmisiti
acmisiti / gist:9259457
Created February 27, 2014 21:00
PATCH save
this.employee.save({
manager : that.$el.find('#manager').val(),
title : that.$el.find('#title').val(),
department : that.$el.find('#department').val(),
}, {patch : true});
Staff model which creates resource uri and passes "'?type=consultant'" if is_consultant flag is true.
TCB.Models.StaffModel = Backbone.Model.extend({
urlRoot : function(){
return '/m/api/v1/user/' + this.get('id') + '/';
},
url : function(){
if(this.get('is_consultant')){
@acmisiti
acmisiti / gist:7454101
Created November 13, 2013 18:41
Something I just noticed with the wage backbone stuff in the profile. When you add methods to backbone views, avoid at all costs using just jquery selector $(..). Try to always use this.$el.find(....). I avoid it as much as possible and really try my hardest to only use it for general alerts which i keep in employiiAnimations.js. Other than that…
TCB.Views.StaffProfileCompensation = Backbone.View.extend({
el: "#js-staff-profile-compensation",
attributes : function(){
return {}
},
initialize: function(){
},
@acmisiti
acmisiti / hrbox_import_employees.js
Created November 28, 2012 18:22
the bug that wasted 1.5 hours ----- generic for all forms that submit and included in assets.yml --- should be setting page specific BRO
$(document).ready(function(){
$('input[type=submit]').on('click', function(e) {
e.preventDefault();
$('.js-row-import').each(function(){
var $t = $(this);
console.log($t.val())
});