Skip to content

Instantly share code, notes, and snippets.

View subblue's full-sized avatar
🚀

Tom Beddard subblue

🚀
View GitHub Profile
# Command Enhancements
# Utility
alias reload='source ~/bin/dotfiles/bash/aliases'
alias ea='mate -w ~/bin/dotfiles/bash/aliases && reload' # Edit aliases
alias ee="mate ~/bin/dotfiles/bash/env"
alias eb="mate ~/bin"
# Quicker cd
alias cg='cd /Library/Ruby/Gems/1.8/gems/'
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
@subblue
subblue / config.log
Created November 29, 2013 08:10
Mapnik brew build error config.log
» more /Users/tom/Library/Logs/Homebrew/mapnik/config.log
file /private/tmp/mapnik-e1l3/mapnik-v2.2.0/SConstruct,line 1032:
Configure(confdir = .sconf_temp)
scons: Configure: Checking for freetype-config...
freetype-config --libs --cflags
-I/usr/local/Cellar/freetype/2.5.1/include/freetype2
-L/usr/local/Cellar/freetype/2.5.1/lib -lfreetype -lz -lbz2 -lpng15
scons: Configure: yes
scons: Configure: Checking for xml2-config...
@subblue
subblue / get_terrain.rb
Last active August 7, 2023 00:45
A script to automate the download and generation of terrain tiles and contour shapes using GDAL for use in TileMill maps. Note - the contour generation doesn't currently work for merged tiles - trying to fix that!
#!/usr/bin/env ruby
require 'fileutils'
# Based on instructions from:
# http://steveko.wordpress.com/2013/09/11/terrain-in-tilemill-a-walkthrough-for-non-gis-types/
#
# Further reading:
# https://www.mapbox.com/tilemill/docs/guides/terrain-data/
# https://www.mapbox.com/blog/tilemill-raster-colorizer/
# https://www.mapbox.com/tilemill/docs/guides/optimizing-shapefiles/
@subblue
subblue / HDPI canvas scaling respecting page zoom
Created January 9, 2015 12:04
Scaling factor for HDPI canvas elements that also respects user defined page zoom
((window.devicePixelRatio || 1) * Math.max(window.outerWidth / window.innerWidth, 1)).toFixed(3) * 1
@subblue
subblue / gulpfile.coffee
Created March 29, 2015 13:56
Gulp build file for the new subblue website
# node modules
fs = require 'fs'
path = require 'path'
url = require 'url'
browserSync = require 'browser-sync'
browserify = require 'browserify'
watchify = require 'watchify'
source = require 'vinyl-source-stream'
del = require 'del'
@subblue
subblue / resizer.coffee
Created October 24, 2015 16:16
Small class for resizing images using the canvas object but by progressively reducing by half to generate a smoother end result
perf = window.performance || Date
class Resizer
constructor: (srcImg, @options = {}) ->
if typeof srcImg == 'string'
@loadImage(srcImg)
if srcImg.toString().indexOf('Blob') > -1
@subblue
subblue / webpack-dev.js
Created June 5, 2016 08:27
General Webpack dev config
'use strict';
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const npmPackage = require('./package.json');
const host = '0.0.0.0';
const port = 3000;
const config = {
entry: [
'babel-polyfill',
@subblue
subblue / package.json
Created June 5, 2016 08:36
General React.js dev package.json
{
"name": "test-app",
"version": "0.0.1",
"description": "Test App",
"main": "index.js",
"scripts": {
"start": "clear && NODE_ENV=development webpack-dev-server --config webpack-dev.js --devtool cheap-module-source-map --inline --hot",
"test": "clear && watch 'npm run --silent mocha' ./src -d -u",
"mocha": "clear && mocha --opts mocha.opts ./src/**/*-test.js",
},
@subblue
subblue / RichTextEditor.js
Last active June 6, 2016 09:54
RichTextEditor
'use strict';
/* eslint "react/prop-types": 0 */
// import Immutable from 'immutable';
import React, { PropTypes, Component } from 'react';
import { Editor, EditorState, ContentState, RichUtils, convertFromHTML, convertFromRaw } from 'draft-js';
import { stateToHTML } from 'draft-js-export-html';
// based on this example:
// https://github.com/facebook/draft-js/tree/master/examples/rich