Skip to content

Instantly share code, notes, and snippets.

View subblue's full-sized avatar
🚀

Tom Beddard subblue

🚀
View GitHub Profile
@subblue
subblue / wwc-links.md
Created June 26, 2018 13:12
Women Who Code Meetup Links - 26 June 2018
@subblue
subblue / pbr.glsl
Created January 27, 2017 20:40 — forked from galek/pbr.glsl
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@subblue
subblue / jslinks.md
Last active August 27, 2017 16:27
JS Dev links
@subblue
subblue / eslintrc.json
Created June 7, 2016 12:50
.eslintrc rules
{
"root": true,
"parser": "babel-eslint",
"plugins": ["react"],
"extends": ["eslint:recommended", "plugin:react/recommended"],
"env": {
"browser": true,
"node": true,
"es6": true,
"jasmine": true,
@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
@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 / 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 / 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 / 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 / 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