Skip to content

Instantly share code, notes, and snippets.

View david-hodgetts's full-sized avatar

david hodgetts david-hodgetts

View GitHub Profile
@david-hodgetts
david-hodgetts / data-nugget_to_data-scalars.js
Created November 14, 2017 14:56
from data-nugget to data-scalars
// from data-nugget to data-scalars,
// a first end to end look at the problem by example
const Immutable = require('immutable');
// let's define some record structure to represent simple type schemas.
// we need some composite types…
let ListType = Immutable.Record({type:'List', kind:'Collection', fields: Immutable.Map()}, 'ListType');
let MapType = Immutable.Record({type:'Map', kind:'Collection', fields: Immutable.Map()}, 'MapType');
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
@david-hodgetts
david-hodgetts / start_web_server.scpt
Last active October 12, 2016 12:24
applescript that launches Python's simple http server in the directory containing the script
tell application "Finder"
set cwd_ to folder of (path to me) as alias
set path_ to (POSIX path of cwd_)
tell application "Terminal"
activate
do script ("cd " & quoted form of path_) & ";python -m SimpleHTTPServer"
end tell
end tell

rasberry pi kiosk development frameworks and tools

Shader "Noia/DoubleFacedExample" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class ShowMyTransforms : MonoBehaviour {
void OnDrawGizmos(){
Gizmos.color = Color.red;
Gizmos.DrawLine (transform.position, transform.position + transform.right);
@david-hodgetts
david-hodgetts / post-receive.rb
Created August 10, 2015 13:09
ruby post receive hook (deploy with git) (hooks/post-receive)
#!/usr/bin/env ruby
# post-receive
# 1. Read STDIN (Format: "from_commit to_commit branch_name")
from, to, branch = ARGF.read.split " "
# 2. Only deploy if master branch was pushed
if (branch =~ /master$/) == nil
puts "Received branch #{branch}, not deploying."
exit
@david-hodgetts
david-hodgetts / parseQuery.js
Last active August 29, 2015 14:26
quick and dirty function to parse query string
var parseQuery = function(queryString){
var possibleMatches = queryString.replace(/ /g,'').split('&'),
regex = /(\w+)=(\w+)/;
return possibleMatches.reduce(function(array, current){
var match = regex.exec(current);
if(match){
array.push({
@david-hodgetts
david-hodgetts / scaleLightRange
Created February 19, 2015 11:37
scale light range with parent transform on runtime
using UnityEngine;
using System.Collections;
public class ScaleLightRange : MonoBehaviour {
Light _light;
float _onAwakeRange;
float _onAwakeScaleFactor;
void Awake () {
@david-hodgetts
david-hodgetts / bytes2file
Created February 11, 2015 08:14
write n (count) random bytes to file test.dat
dd if=/dev/urandom of=test.dat bs=1 count=8