Skip to content

Instantly share code, notes, and snippets.

View tombola's full-sized avatar

Tom Readings tombola

  • Freelance
  • Devon
View GitHub Profile
@tombola
tombola / csv_splitter.py
Last active November 8, 2019 10:48 — forked from jrivero/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True, verbose=False):
import csv
reader = csv.reader(filehandler, delimiter=delimiter)
current_piece = 1
current_out_path = os.path.join(
output_path,
output_name_template % current_piece
@tombola
tombola / example.module.php
Last active March 17, 2017 13:29 — forked from zerolab/example.module.php
Drupal 8 pass data down ER fields
<?php
/**
* @file
* An example of how to pass the item number from a multi-value
* entityreference field to the entities concerned.
*/
/**
* Implements hook_preprocess_field().
@tombola
tombola / 0_reuse_code.js
Created January 13, 2017 15:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console