Skip to content

Instantly share code, notes, and snippets.

View brianbancroft's full-sized avatar
🌲

Brian Bancroft brianbancroft

🌲
View GitHub Profile
#Main Program, used to georeference and index rasters. This is intended to be run in ArcGIS 10.1 or higher.
#import basic modules
import os, arcpy, shutil
#import all modules from 3rd parties
import xlrd, xlwt, zipfile
############################BEGIN LOCAL FUNCTIONS#####################################
###a1. Check for error:###
@brianbancroft
brianbancroft / gist:9e27956e77482085d09d
Last active September 8, 2015 14:22
CartoDB InfoWindow Height Problems
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style>
html, body, #map {
height: 100%;
padding: 0;
@brianbancroft
brianbancroft / for_brian.py
Last active December 31, 2015 21:09 — forked from mrmch/for_brian.py
I've played around with the file, learnt a few new things and still am drawing a bit of a blank.
fname = 'C:\\Temp\\SIC_Core.txt'
ofname = 'C:\\Temp\\SIC_Fixed.txt'
with open(fname, 'r') as ifile:
input = ifile.readlines(-1)
with open(ofname, 'w') as ofile:
i = 0
while i < len(input):
@brianbancroft
brianbancroft / muck.txt
Created March 29, 2016 12:58
Playing around with Ruby command line
vagrant [tu (master)⚡]> pry
[1] pry(main)> my_array = [5,3,7,2]
=> [5, 3, 7, 2]
[2] pry(main)> my_array.sort
=> [2, 3, 5, 7]
[3] pry(main)> my_array
=> [5, 3, 7, 2]
[4] pry(main)> my_array.sort!
=> [2, 3, 5, 7]
[5] pry(main)> include Math
#banner_print.rb
$tax_rate = 0.15
$colour_rate_breakpoint = 2
$colour_cost_low = 10
$colour_cost_high = 15
$cost_pr_sqft = 15
#single function
def calculate_cost(dim_x, dim_y, num_colours)
price = calculate_tax(calculate_area_cost(dim_x, dim_y) + colour_cost(num_colours))
var myNum = 3;
function arrayOfLight(myNum){
var myArr = [];
for (i = 1; i <= myNum; i++) {
myArr.push(i);
}
return myArr;
@brianbancroft
brianbancroft / index.html
Created May 2, 2016 20:33
Mucking with Console.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ajax Example</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@brianbancroft
brianbancroft / scraper.rb
Created May 11, 2016 18:36
parl.gc.ca scraper
def getConstitInfo(page)
doc = Nokogiri::HTML(open(htmlDOC))
regexp = /(\d+)\)$/
ridingsList = []
constitList = doc.css('.constituency a')
constitList.each do |constit|
ridingsList.push({:name => constit.text, :riding_id =>
regexp.match(constit.attributes["href"])[1]})
end