Skip to content

Instantly share code, notes, and snippets.

View hugs's full-sized avatar
🤖
Making robots

Jason Huggins hugs

🤖
Making robots
View GitHub Profile
@hugs
hugs / motion.js
Last active January 26, 2018 00:09
An improved algorithm for controlling Tapster motion
/*
// Usage:
// motion.move(pointA, pointB, numberOfSteps, easingType, timeDeltaInMilliseconds)
// Example
$ node bot.js
>> motion = require('./motion')
>> motion.move([0,0,-140],[-20,20,-140], 20, 'easeInOutCubic', 500)
>> motion.move([-20,60,-165],[-20,-60,-165], 30, 'easeInOutCubic', 20)
>> motion.move([-20,-60,-165],[-20,60,-165], 30, 'easeInOutCubic', 20)
@hugs
hugs / blink.code
Last active December 18, 2017 21:13
Blink (aka "Arduino Hello World")
@hugs
hugs / 1_clown-shoe.stl
Last active June 27, 2017 02:42
Parametric Clown Shoe! Why? Because Clown Shoe!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sudo apt-get update
sudo apt-get upgrade
# Install needed tools
sudo apt-get install build-essential
sudo apt-get install chromium-browser
sudo apt-get install vim
sudo apt-get install curl
sudo apt-get install python
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
@hugs
hugs / 1 - makefile
Last active April 12, 2017 22:42
Make me a sandwich
# Copyright (c) 2017 Make Me A Sandwich Developers
# MIT License (See LICENSE.txt)
# Inspiration: https://xkcd.com/149/
# Usage:
# $ make me a sandwich
# What? Make it yourself.
#
# $ sudo make me a sandwich
@hugs
hugs / eval.js
Last active December 28, 2016 19:17
Eval.js Example
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
@hugs
hugs / README.md
Last active December 28, 2016 19:16 — forked from elidupuis/README.md
Simple Drawing Example

Simple Drawing Example

Click and drag your mouse (or finger on touch device) to draw a line. A new path is created for each touch or click.

Paths are stored in a nested array; you can inspect the variable in console: session (assuming the example is in it's own window).

@hugs
hugs / new-objects-with-generators.md
Last active December 24, 2016 16:28
Experiments creating new objects in JavaScript, with regular functions and generator functions

Creating New Objects with Generators

Here are some experiments creating new objects in JavaScript... with regular functions and generator functions.

Why?

I've been playing around converting regular functions into generator functions, and I recently ran into a problem: generators are not "new-able". You can't create new objects when the constructor is a generator.

Some background:

@hugs
hugs / arc-example.html
Created November 5, 2016 15:52
Arc Examples
<html>
<head>
<meta charset="utf-8">
<style>
body {
margin: 30px;
}
</style>
</head>
<body>