Skip to content

Instantly share code, notes, and snippets.

View adamscybot's full-sized avatar

adamscybot adamscybot

  • London
View GitHub Profile
@adamscybot
adamscybot / usePercentageColumns.js
Created August 18, 2020 11:36
Reac table v6 percentage column width plugin hook
/**
* This plugin hook for React table provides the ability for percentage
* widths to be provided in the column definitions, whilst maintaining the
* ability to resize those columns.
*/
export const usePercentageColumns = hooks => {
hooks.useInstance.push(useInstance)
hooks.getRowProps.push(getRowStyles)
hooks.getHeaderProps.push(getHeaderProps)
hooks.getCellProps.push(getCellProps)
@adamscybot
adamscybot / get-balance.js
Created June 30, 2014 20:29
Retrieve total balance of student loan from student finance direct pages
// First go to https://secure.studentfinance.direct.gov.uk/ and log in.
// Now go to https://secure.studentfinance.direct.gov.uk/customer/payments/view?service=direct/1/Home/listPayments_TablePages.pages_linkPage&sp=AHome%2FlistPayments_TableView&sp=1
// Now open the console and put in:
//
// var jq = document.createElement('script');
// jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
// document.getElementsByTagName('head')[0].appendChild(jq);
// jQuery.noConflict();
//
// Press enter.
@adamscybot
adamscybot / 3-layer-resource-api.py
Created February 14, 2012 16:29
Bug when posting 3-layer resource
class ServiceResource(ModelResource):
manager = fields.ToOneField(UserResource, 'manager',full=True)
area = fields.ToOneField(AreaResource, 'area',full=True)
specification = fields.ToManyField('services.api.ServiceSpecResource','servicespec_set',full=True)
class Meta:
queryset = Service.objects.all()
resource_name = 'service'
class ServiceSpecResource(ModelResource):
service = fields.ToOneField(ServiceResource,'service')