Skip to content

Instantly share code, notes, and snippets.

View dominijk's full-sized avatar

Dominic Humphrey dominijk

View GitHub Profile
@dominijk
dominijk / snippets
Last active November 17, 2018 16:16
Postgres postgis mac osx brew command line bits
brew stuff;
--to install using brew
brew install postgres@version
--get details about what is installed using brew
brew postgres info
--show current postgres versions running
brew services list
@dominijk
dominijk / Add class prefix
Created May 1, 2018 18:23
Vectorworks snippets
Procedure PrefixClasses;
{ Add "OS-" to the front of classes that begin with "G80". }
CONST
Prefix = 'G80';
VAR
ClassName, NewName :STRING;
i :INTEGER;
BEGIN
i := 1;
@dominijk
dominijk / hosting-on-github.md
Created February 1, 2018 18:04 — forked from TylerFisher/hosting-on-github.md
Basic steps for hosting on Github

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level directory.
  6. Back in the GitHub application, you should see your files in the left column. Make sure they are all checked. If so, enter a mess
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@dominijk
dominijk / QGIS POSTGIS useful snippets.sql
Last active August 17, 2017 16:03
Useful code bits
--adds serial to table so you can bring to QGIS
ALTER TABLE aa_intersects2 ADD COLUMN id SERIAL PRIMARY KEY;
--adds spatial index to table to speed up queries
CREATE INDEX gidx_osba_bldgs_geom ON d_os_vectormap_bldgs USING GIST (geom);
ST_DumpRings
—-Returns a set of geometry_dump rows, representing the exterior and interior rings of a polygon.
--get table data,to make select statements faster to write
--for taking query views into main analysis table
update analysis_by_postcode_sector
set scat18_1sqm_sector = voarecord1_analysis_bysector_scat_18_all.voa_list_sector,
scat18_all_sum = voarecord1_analysis_bysector_scat_18_all.sum,
scat18_all_avg = voarecord1_analysis_bysector_scat_18_all.avg,
scat18_all_max = voarecord1_analysis_bysector_scat_18_all.max
from voarecord1_analysis_bysector_scat_18_all
where analysis_by_postcode_sector.voa_record1_sector_name_check::text = voarecord1_analysis_bysector_scat_18_all.voa_list_sector::text;
--for taking query views into main analysis table
update analysis_by_postcode_sector
set scat18_1sqm_sector = voarecord1_analysis_bysector_scat_18_all.voa_list_sector,
scat18_all_sum = voarecord1_analysis_bysector_scat_18_all.sum,
scat18_all_avg = voarecord1_analysis_bysector_scat_18_all.avg,
scat18_all_max = voarecord1_analysis_bysector_scat_18_all.max
from voarecord1_analysis_bysector_scat_18_all
where analysis_by_postcode_sector.voa_record1_sector_name_check::text = voarecord1_analysis_bysector_scat_18_all.voa_list_sector::text;
@dominijk
dominijk / Rule based labelling
Last active June 23, 2017 12:52
QGIS Helpful Expressions & rules
--Apply in the 'Label with' part of the properties
if( $area > 1600, "field_name_for_the_label" , None)
if( $area > 80000, regexp_replace( "name",'[(](.*)?[)]','' ) , None)
-- which means if the calculated area (project settings) is over then use the "name" column to label if not then no label,
--also strips anything within a bracket from the label
--Apply in the label size field from the expressions button
@dominijk
dominijk / ReadMe
Created March 24, 2017 10:45
Nationwide House price data region definition
USE AT OWN RISK I'VE COMPILED THIS BASED ON THE FOLLOWING;
==========
Nationwide house price regions
=============
EAST ANGLIA
EAST MIDS
LONDON
NORTH ** asumed as ONS north east , tested personal loan northeast postcode in nationwide mortgage look up; what regoin query? and returned as N.E
NORTH WEST
@dominijk
dominijk / OSM London Stations
Created February 18, 2017 10:20
OSM Select snippet for London UK main terminating stations
"Station" IN ('Kings Cross St. Pancras', 'Victoria','Waterloo' , 'Marylebone' , 'Paddington' , 'Euston' , 'Liverpool Street', 'London Bridge')