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 / 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
@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 / compare_branches
Last active March 23, 2017 10:35
List view modes used in current branches (from config filenames, rather than db).
#!/usr/bin/env bash
list_node_viewmodes() {
read BRANCH
REPLACE='config/sync/core.entity_view_mode.node.'
if [[ $BRANCH ]]; then
echo '========='$BRANCH
echo ''
git ls-tree -r --name-only $BRANCH | grep "config\/sync\/core\.entity_view_mode\.node" | \
while read VIEWMODES
@tombola
tombola / sshhosts.sh
Created January 8, 2018 17:22
List ssh aliases
# list ssh host aliases
alias sshhosts="grep -w -i "Host" ~/.ssh/config | sed 's/Host//' | sed 's/[[:blank:]]//g'"
sshhosts | grep '<part-of-host-name>'

Keybase proof

I hereby claim:

  • I am tombola on github.
  • I am treadings (https://keybase.io/treadings) on keybase.
  • I have a public key ASC6_K6y-8coEJ4YZ33imFalIQWh0gdrpA7pFM52QvNtDgo

To claim this, I am signing this object:

@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
<script src="https://rca.accessplanit.com/accessplansandbox/NetLibrary/ClientScripts/webintegration.js"></script>
<script type="text/javascript">
console.log('script ran')
var courseOptions = {
ListID: 'courses',
CourseIDs: [731014],
CompanyID: "ROYALC9RCH",
CategoryIDs: []
}
var opportunityOptions = {

How do wagtail and django relate?

Django

is a web framework

Used by Instagram, Spotify, The Washington Post, loads of other big and small sites.

There are lots of different ways you can use python. Your end goal might be to use python to process data from spreadsheets, bulk edit a load of images, or analyse genetic code, anything really.

"""
Example usage:
dj shell < wagtail_list_allowed_subpages.py
Returns markdown formatted list of which page types can be added under which.
"""
def list_valid_page_subpages(readable=False, shorten=False):
from wagtail.core.models import Page
@tombola
tombola / controlshift.postman_collection.json
Last active November 4, 2021 12:15
Control Shift API - postman collection
{
"info": {
"name": "Control Shift",
"description": "For this collection of requests to authenticate, you will need to add a couple of additional variables to an 'environment' and activate that.\n\n- `CS_REST_CLIENT_ID`\n- `CS_REST_CLIENT_SECRET`",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "CS: Unauth JSON",
"item": [